Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ void print_transaction(dogecoin_tx* x) {
// parse inputs:
unsigned int i = 0;
for (; i < x->vin->len; i++) {
printf("block->parent_coinbase->tx_in->i: %d\n", i);
printf("block->parent_coinbase->tx_in->i: %u\n", i);
dogecoin_tx_in* tx_in = vector_idx(x->vin, i);
printf("block->parent_coinbase->vin->prevout.n: %d\n", tx_in->prevout.n);
printf("block->parent_coinbase->vin->prevout.n: %" PRIu32 "\n", tx_in->prevout.n);
char* hex_utxo_txid = utils_uint8_to_hex(tx_in->prevout.hash, sizeof tx_in->prevout.hash);
printf("block->parent_coinbase->tx_in->prevout.hash: %s\n", hex_utxo_txid);
char* script_sig = utils_uint8_to_hex((const uint8_t*)tx_in->script_sig->str, tx_in->script_sig->len);
Expand All @@ -261,12 +261,12 @@ void print_transaction(dogecoin_tx* x) {
// parse outputs:
i = 0;
for (; i < x->vout->len; i++) {
printf("block->parent_coinbase->tx_out->i: %d\n", i);
printf("block->parent_coinbase->tx_out->i: %u\n", i);
dogecoin_tx_out* tx_out = vector_idx(x->vout, i);
printf("block->parent_coinbase->tx_out->script_pubkey: %s\n", utils_uint8_to_hex((const uint8_t*)tx_out->script_pubkey->str, tx_out->script_pubkey->len));
printf("block->parent_coinbase->tx_out->value: %" PRId64 "\n", tx_out->value);
}
printf("block->parent_coinbase->locktime: %d\n", x->locktime);
printf("block->parent_coinbase->locktime: %" PRIu32 "\n", x->locktime);
cstr_free(tx, true);
}

Expand All @@ -287,14 +287,14 @@ void print_parent_header(dogecoin_auxpow_block* block) {
printf("block->parent_coinbase_merkle[%zu]: "
"%s\n", j, hash_to_string((uint8_t*)block->parent_coinbase_merkle[j]));
}
printf("block->parent_merkle_index: %d\n", block->parent_merkle_index);
printf("block->parent_merkle_index: %" PRIu32 "\n", block->parent_merkle_index);
printf("block->aux_merkle_count: %d\n", block->aux_merkle_count);
j = 0;
for (; j < block->aux_merkle_count; j++) {
printf("block->aux_merkle_branch[%zu]: "
"%s\n", j, hash_to_string((uint8_t*)block->aux_merkle_branch[j]));
}
printf("block->aux_merkle_index: %d\n", block->aux_merkle_index);
printf("block->aux_merkle_index: %" PRIu32 "\n", block->aux_merkle_index);
printf("block->parent_header->version: %i\n", block->parent_header->version);
printf("block->parent_header->prev_block: %s\n", hash_to_string(block->parent_header->prev_block));
printf("block->parent_header->merkle_root: %s\n", hash_to_string(block->parent_header->merkle_root));
Expand Down
2 changes: 1 addition & 1 deletion src/cli/spvnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ dogecoin_bool spv_header_message_processed(struct dogecoin_spv_client_* client,
UNUSED(node);
if (newtip) {
time_t timestamp = client->headers_db->getchaintip(client->headers_db_ctx)->header.timestamp;
printf("New headers tip height %d from %s\n", newtip->height, ctime(&timestamp));
printf("New headers tip height %" PRIu32 " from %s\n", newtip->height, ctime(&timestamp));
}
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions src/cli/such.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

*/

#include <inttypes.h>
#include <assert.h>
#include <ctype.h>
#ifndef _MSC_VER
Expand Down Expand Up @@ -1604,7 +1605,7 @@ int main(int argc, char* argv[])
enum dogecoin_tx_out_type type = dogecoin_script_classify(script, NULL);
printf("script: %s\n", scripthex);
printf("script-type: %s\n", dogecoin_tx_out_type_to_str(type));
printf("inputindex: %d\n", inputindex);
printf("inputindex: %" PRIu32 "\n", inputindex);
printf("sighashtype: %d\n", sighashtype);
printf("hash: %s\n", hex);

Expand Down Expand Up @@ -2347,7 +2348,7 @@ int main(int argc, char* argv[])
return showError("Failed to generate wif address from mnemonic\n");
}

printf("Address %d: %s\n", inputindex, hd_pubkey_address);
printf("Address %" PRIu32 ": %s\n", inputindex, hd_pubkey_address);
}

/* clear and free passphrase */
Expand Down
3 changes: 2 additions & 1 deletion src/cli/tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
OTHER DEALINGS IN THE SOFTWARE.
*/

#include <inttypes.h>
#include <assert.h>
#ifdef HAVE_CONFIG_H
# include "libdogecoin-config.h"
Expand Down Expand Up @@ -184,7 +185,7 @@ dogecoin_bool hd_print_node(const dogecoin_chainparams* chain, const char* nodes
if (dogecoin_hdnode_has_privkey(&node)) {
printf("privatekey WIF: %s\n", privkey_wif);
}
printf("depth: %d\n", node.depth);
printf("depth: %" PRIu32 "\n", node.depth);
printf("child index: %u\n", node.child_num);
char addr[34 + 1];
addresses_from_pubkey(&dogecoin_chainparams_main, str, addr);
Expand Down
7 changes: 4 additions & 3 deletions src/headersdb_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

*/

#include <inttypes.h>
#include <sys/stat.h>

#include <dogecoin/headersdb_file.h>
Expand Down Expand Up @@ -255,7 +256,7 @@ dogecoin_bool dogecoin_headers_db_load(dogecoin_headers_db* db, const char *file
dogecoin_blockindex *pindex = dogecoin_headers_db_connect_hdr(db, &cbuf_all, true, &connected);
if (!connected)
{
printf("\nConnecting header %s failed (at height: %d) read_write: %d\n", hash_to_string(hash), db->chaintip->height, db->read_write_file);
printf("\nConnecting header %s failed (at height: %" PRIu32 ") read_write: %d\n", hash_to_string(hash), db->chaintip->height, db->read_write_file);
dogecoin_free(pindex);
}
else {
Expand All @@ -266,7 +267,7 @@ dogecoin_bool dogecoin_headers_db_load(dogecoin_headers_db* db, const char *file
}
}
}
printf("\nConnected %ld headers, now at height: %d\n", connected_headers_count, db->chaintip->height);
printf("\nConnected %ld headers, now at height: %" PRIu32 "\n", connected_headers_count, db->chaintip->height);
return (db->headers_tree_file != NULL);
}

Expand Down Expand Up @@ -412,7 +413,7 @@ dogecoin_blockindex * dogecoin_headers_db_connect_hdr(dogecoin_headers_db* db, s
current_block = prev_block;
}

printf("\nChain reorganization: %d blocks disconnected, %d blocks connected\n", blockindex->height - common_ancestor->height, blockindex->height - db->chaintip->height);
printf("\nChain reorganization: %" PRIu32 " blocks disconnected, %" PRIu32 " blocks connected\n", blockindex->height - common_ancestor->height, blockindex->height - db->chaintip->height);

// Set the new block as the new chain tip
db->chaintip = blockindex;
Expand Down
3 changes: 2 additions & 1 deletion src/spv.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

#ifdef _WIN32
#include <inttypes.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <conio.h>
Expand Down Expand Up @@ -1102,7 +1103,7 @@ void dogecoin_net_spv_post_cmd(dogecoin_node *node, dogecoin_p2p_msg_hdr *hdr, s
strftime(s, sizeof s, "%F %T", p);
char *ctime_no_newline;
ctime_no_newline = strtok(s, "\n");
printf("%s|%d|%s|%d\n", hash_to_string(pindex->hash), pindex->height, ctime_no_newline, hdr->data_len);
printf("%s|%" PRIu32 "|%s|%" PRIu32 "\n", hash_to_string(pindex->hash), pindex->height, ctime_no_newline, hdr->data_len);
uint64_t start = time(NULL);

uint32_t amount_of_txs;
Expand Down
3 changes: 2 additions & 1 deletion src/validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

*/

#include <inttypes.h>
#include <dogecoin/validation.h>
#include <dogecoin/block.h>

Expand Down Expand Up @@ -71,7 +72,7 @@ dogecoin_bool check_auxpow(dogecoin_auxpow_block* block, dogecoin_chainparams* p
where the height is known. */
if (!is_legacy(block->header->version) && params->strict_id && get_chainid(block->header->version) != params->auxpow_id) {
printf("%s:%d:%s : block does not have our chain ID"
" (got %d, expected %d, full nVersion %d) : %s\n",
" (got %" PRIu32 ", expected %u, full nVersion %" PRIu32 ") : %s\n",
__FILE__, __LINE__, __func__, get_chainid(block->header->version),
params->auxpow_id, block->header->version, strerror(errno));
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ uint8_t* dogecoin_get_utxos(char* address) {
if (strncmp(utxo->address, address, strlen(utxo->address))==0 && !is_spent(utxo)) {
int utxo_index_length = integer_length(i);
char* utxo_index_hex = dogecoin_char_vla(utxo_index_length+1);
sprintf(utxo_index_hex, "%d", i);
sprintf(utxo_index_hex, "%u", i);
// index
concat_str = concat(concat_str, utxo_index_hex);
char* txid_hex = utils_uint8_to_hex(utxo->txid, 32);
Expand Down