From 77cf47f9610b758fa38421b2ebf750f77a8cab9c Mon Sep 17 00:00:00 2001 From: edtubbs Date: Mon, 4 Nov 2024 13:58:32 -0600 Subject: [PATCH 1/2] ci: updated runner to macos-13 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0fd0e444..f39380e22 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: goal: install - name: x86_64-macos host: x86_64-apple-darwin15 - os: macos-12 + os: macos-13 run-tests: true dep-opts: "SPEED=slow V=1" config-opts: "--enable-static --disable-shared --enable-test-passwd" From cb5b767c40144f26c306dcb02cf1faa8703ef73e Mon Sep 17 00:00:00 2001 From: edtubbs Date: Wed, 18 Dec 2024 13:22:53 -0600 Subject: [PATCH 2/2] validation: check auxpow PoW before other checks block: check parent coinbase for input Ported from dogecoin/dogecoin@51cbc1f --- src/block.c | 7 +++++++ src/validation.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/block.c b/src/block.c index 45d33be70..3b77f112e 100644 --- a/src/block.c +++ b/src/block.c @@ -72,6 +72,13 @@ dogecoin_bool check(void *ctx, uint256* hash, uint32_t chainid, dogecoin_chainpa uint256* chain_merkle_root = check_merkle_branch(hash, chain_merkle_branch, block->aux_merkle_index); vector_free(chain_merkle_branch, true); + // Check that there is at least one input in the parent coinbase transaction + if (block->parent_coinbase->vin->len == 0) { + printf("Aux POW coinbase has no inputs\n"); + dogecoin_free(chain_merkle_root); + return false; + } + // Convert the root hash to a human-readable format (hex) unsigned char vch_roothash[64]; // Make sure it's large enough to hold the hash memcpy(vch_roothash, hash_to_string((uint8_t*)chain_merkle_root), 64); // Copy the data diff --git a/src/validation.c b/src/validation.c index 148238b41..ea7d4df27 100644 --- a/src/validation.c +++ b/src/validation.c @@ -95,14 +95,6 @@ dogecoin_bool check_auxpow(dogecoin_auxpow_block* block, dogecoin_chainparams* p } /* We have auxpow. Check it. */ - uint256 block_header_hash; - dogecoin_block_header_hash(block->header, block_header_hash); - uint32_t chainid = get_chainid(block->header->version); - if (!block->header->auxpow->check(block, &block_header_hash, chainid, params)) { - printf("%s:%d:%s : AUX POW is not valid : %s\n", __FILE__, __LINE__, __func__, strerror(errno)); - return false; - } - uint256 parent_hash; cstring* s2 = cstr_new_sz(64); dogecoin_block_header_serialize(s2, block->parent_header); @@ -113,5 +105,13 @@ dogecoin_bool check_auxpow(dogecoin_auxpow_block* block, dogecoin_chainparams* p return false; } + uint256 block_header_hash; + dogecoin_block_header_hash(block->header, block_header_hash); + uint32_t chainid = get_chainid(block->header->version); + if (!block->header->auxpow->check(block, &block_header_hash, chainid, params)) { + printf("%s:%d:%s : AUX POW is not valid : %s\n", __FILE__, __LINE__, __func__, strerror(errno)); + return false; + } + return true; }