Skip to content

Commit 229fddb

Browse files
committed
Merge branch 'feature/bitcoin-v26.2-merge' of https://github.com/DigiByte-Core/digibyte into feature/bitcoin-v26.2-merge
2 parents 5abc8bb + fa715d0 commit 229fddb

9 files changed

Lines changed: 39 additions & 34 deletions

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static const int MAX_BLOCKTXN_DEPTH = 10;
121121
* Larger windows tolerate larger download speed differences between peer, but increase the potential
122122
* degree of disordering of blocks on disk (which make reindexing and pruning harder). We'll probably
123123
* want to make this a per-peer adaptive value at some point. */
124-
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 4096;
124+
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024;
125125
/** Block download timeout base, expressed in multiples of the block interval (i.e. 10 min) */
126126
static constexpr double BLOCK_DOWNLOAD_TIMEOUT_BASE = 1;
127127
/** Additional block download timeout per parallel downloading peer (i.e. 5 min) */

src/wallet/wallet.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,12 +2007,19 @@ bool CWallet::SubmitTxMemoryPoolAndRelay(CWalletTx& wtx, std::string& err_string
20072007
bool ret = chain().broadcastTransaction(wtx.tx, m_default_max_tx_fee, relay, err_string);
20082008
if (ret) {
20092009
wtx.m_state = TxStateInMempool{};
2010-
// Refresh status to ensure we have the correct state (mempool vs stempool)
2011-
RefreshMempoolStatus(wtx, chain());
2010+
// When Dandelion is disabled, transactions go directly to mempool but may take
2011+
// time to propagate through internal structures. Don't overwrite the state we
2012+
// just set unless we're certain the transaction is not in mempool.
20122013
if (gArgs.GetBoolArg("-dandelion", true)) {
2014+
// Only refresh status for Dandelion mode where stempool/mempool transitions occur
2015+
RefreshMempoolStatus(wtx, chain());
20132016
WalletLogPrintf("SubmitTxMemoryPoolAndRelay: Transaction %s submitted for Dandelion routing, state=%s\n",
20142017
wtx.GetHash().ToString(),
20152018
wtx.state<TxStateInMempool>() ? "InMempool" : "NotInMempool");
2019+
} else {
2020+
// In non-Dandelion mode, trust that broadcastTransaction success means InMempool
2021+
WalletLogPrintf("SubmitTxMemoryPoolAndRelay: Transaction %s added to mempool (Dandelion disabled)\n",
2022+
wtx.GetHash().ToString());
20162023
}
20172024
}
20182025
return ret;

test/functional/data/rpc_getblockstats.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@
103103
"02000020c5e1e001bb8e5c325ab00865497d52498b9da09848756da3ed25adb1c7a96536b838a07f0ac41f31c2352d06c38b8a7ca4536fa5e1f33106e8d06a83ab3ae5df2b4ae75affff7f200200000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016400ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
104104
"02000020b4b409e3d6fe79da7111d446cd58b69bb56e724ce253429c703e8140fd2dabee4e06b53a7aa2641a676cbc04f74e212510b73630ec25c58454b113424dfc5c712b4ae75affff7f200700000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016500ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
105105
"020000203b918e752e01d9ed65cc510ec2d0d5f36e1236e41f8a58ceb008d85ae6bbd69e683c218bc1e81ca72f75ce3701a5e3cf387bcbd0e3f867576e8b29dee2b489d52b4ae75affff7f200300000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016600ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
106-
"02000020b1ef3969535bb84a6c6efae11e0c8e6851760e4e56fad6bf348e1ea8c5a3206333b34ac80b72b925072f55b2d6b8e6be8c16a3bf86a953e988218bce326a7b962b4ae75affff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016700ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
107-
"02000020343865ce4529f124cae102f0f3350b1867d28b74714314f7a46f480a62f4dbce9a332f0cb80b556e596172da1ff78aed3a96f092e3062c813ff75b1a4c2a5f2d2c4ae75affff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016800ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000",
108-
"02000020ca2ac2024fcaba89286504ba22abf2afdb630bb08a02ea281421ec7768b4ea5b40097bdf48f92ab915f0e7497053e77e38f97d8895ec8f5d0a887653c4270bb92c4ae75affff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016900ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000"
106+
"02000020b1ef3969535bb84a6c6efae11e0c8e6851760e4e56fad6bf348e1ea8c5a3206333b34ac80b72b925072f55b2d6b8e6be8c16a3bf86a953e988218bce326a7b962b4ae75affff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03016700ffffffff02004071618c0600001976a9149e0fba4896c9771390bf1c931e368cf3494a24da88ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000"
109107
],
110108
"mocktime": 1525107225,
111109
"stats": [

test/functional/feature_coinstatsindex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def _test_coin_stats_index(self):
137137
assert_equal(res5['block_info'], {
138138
'unspendable': Decimal('0E-8'),
139139
'prevout_spent': Decimal('72000.00000000'),
140-
'new_outputs_ex_coinbase': Decimal('71999.96880000'), # DigiByte: Adjusted for 100x fees
141-
'coinbase': Decimal('72000.03120000'), # DigiByte: Adjusted for 100x fees
140+
'new_outputs_ex_coinbase': Decimal('71999.99688000'), # DigiByte: Corrected fees
141+
'coinbase': Decimal('72000.00312000'), # DigiByte: Corrected fees
142142
'unspendables': {
143143
'genesis_block': Decimal('0E-8'),
144144
'bip30': Decimal('0E-8'),

test/functional/feature_segwit.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ def setup_network(self):
128128
self.sync_all()
129129

130130
def success_mine(self, node, txid, sign, redeem_script=""):
131-
send_to_witness(1, node, getutxo(txid), self.pubkey[0], False, Decimal("71998"), sign, redeem_script)
131+
send_to_witness(1, node, getutxo(txid), self.pubkey[0], False, Decimal("71999.998"), sign, redeem_script)
132132
block = self.generate(node, 1)
133133
assert_equal(len(node.getblock(block[0])["tx"]), 2)
134134
self.sync_blocks()
135135

136136
def fail_accept(self, node, error_msg, txid, sign, redeem_script=""):
137-
assert_raises_rpc_error(-26, error_msg, send_to_witness, use_p2wsh=1, node=node, utxo=getutxo(txid), pubkey=self.pubkey[0], encode_p2sh=False, amount=Decimal("71998"), sign=sign, insert_redeem_script=redeem_script)
137+
assert_raises_rpc_error(-26, error_msg, send_to_witness, use_p2wsh=1, node=node, utxo=getutxo(txid), pubkey=self.pubkey[0], encode_p2sh=False, amount=Decimal("71999.998"), sign=sign, insert_redeem_script=redeem_script)
138138

139139
def run_test(self):
140140
self.generate(self.nodes[0], 161) # block 161
@@ -197,15 +197,15 @@ def run_test(self):
197197
for _ in range(5):
198198
for n in range(3):
199199
for v in range(2):
200-
wit_ids[n][v].append(send_to_witness(v, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[n], False, Decimal("71999")))
201-
p2sh_ids[n][v].append(send_to_witness(v, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[n], True, Decimal("71999")))
200+
wit_ids[n][v].append(send_to_witness(v, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[n], False, Decimal("71999.999")))
201+
p2sh_ids[n][v].append(send_to_witness(v, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[n], True, Decimal("71999.999")))
202202

203203
self.generate(self.nodes[0], 1) # block 163
204204

205205
# Make sure all nodes recognize the transactions as theirs
206-
assert_equal(self.nodes[0].getbalance(), balance_presetup - 60 * 72000 + 20 * Decimal("71999") + 72000)
207-
assert_equal(self.nodes[1].getbalance(), 20 * Decimal("71999"))
208-
assert_equal(self.nodes[2].getbalance(), 20 * Decimal("71999"))
206+
assert_equal(self.nodes[0].getbalance(), balance_presetup - 60 * 72000 + 20 * Decimal("71999.999") + 72000)
207+
assert_equal(self.nodes[1].getbalance(), 20 * Decimal("71999.999"))
208+
assert_equal(self.nodes[2].getbalance(), 20 * Decimal("71999.999"))
209209

210210
self.log.info("Verify unsigned p2sh witness txs without a redeem script are invalid")
211211
self.fail_accept(self.nodes[2], "mandatory-script-verify-flag-failed (Operation not valid with the current stack size)", p2sh_ids[NODE_2][P2WPKH][1], sign=False)
@@ -215,10 +215,10 @@ def run_test(self):
215215

216216
self.log.info("Verify witness txs are mined as soon as segwit activates")
217217

218-
send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71998"), sign=True)
219-
send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71998"), sign=True)
220-
send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71998"), sign=True)
221-
send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71998"), sign=True)
218+
send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71999.998"), sign=True)
219+
send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71999.998"), sign=True)
220+
send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71999.998"), sign=True)
221+
send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("71999.998"), sign=True)
222222

223223
assert_equal(len(self.nodes[2].getrawmempool()), 4)
224224
blockhash = self.generate(self.nodes[2], 1)[0] # block 165 (first block with new rules)
@@ -287,7 +287,7 @@ def run_test(self):
287287
# tx2 (segwit input, paying to a non-segwit output) ->
288288
# tx3 (non-segwit input, paying to a non-segwit output).
289289
# tx1 is allowed to appear in the block, but no others.
290-
txid1 = send_to_witness(1, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[0], False, Decimal("71996"))
290+
txid1 = send_to_witness(1, self.nodes[0], find_spendable_utxo(self.nodes[0], 72000), self.pubkey[0], False, Decimal("71999.996"))
291291
hex_tx = self.nodes[0].gettransaction(txid)['hex']
292292
tx = tx_from_hex(hex_tx)
293293
assert tx.wit.is_null() # This should not be a segwit input

test/functional/feature_taproot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,8 +1385,8 @@ def test_spenders(self, node, spenders, input_counts):
13851385
amount = int(random.randrange(int(avg*0.85 + 0.5), int(avg*1.15 + 0.5)) + 0.5)
13861386
balance -= amount
13871387
fund_tx.vout.append(CTxOut(amount, spenders[done + i].script))
1388-
# Add change
1389-
fund_tx.vout.append(CTxOut(balance - 10000, random.choice(host_spks)))
1388+
# Add change (DigiByte uses higher fees than Bitcoin)
1389+
fund_tx.vout.append(CTxOut(balance - 1000000, random.choice(host_spks)))
13901390
# Ask the wallet to sign
13911391
fund_tx = tx_from_hex(node.signrawtransactionwithwallet(fund_tx.serialize().hex())["hex"])
13921392
# Construct UTXOData entries

test/functional/feature_utxo_set_hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def test_muhash_implementation(self):
6969
assert_equal(finalized[::-1].hex(), node_muhash)
7070

7171
self.log.info("Test deterministic UTXO set hash results")
72-
assert_equal(node.gettxoutsetinfo()['hash_serialized_3'], "a345b92b5a02673693808bfd2c43deed8cefa7cea9cb1877c8582861329b46cc") # DigiByte hash
73-
assert_equal(node.gettxoutsetinfo("muhash")['muhash'], "c2c9e5df0d95bc8bcefb9615383548e07a525d08627f3a5704ced0b639af5537") # DigiByte muhash
72+
assert_equal(node.gettxoutsetinfo()['hash_serialized_3'], "f2394386f671a23886fec1b819caa4d6c5cf9fde0a34f54e282e19ded9dc94fc") # DigiByte v8.26 hash
73+
assert_equal(node.gettxoutsetinfo("muhash")['muhash'], "b9678ef04621339679a49e5e2ddd916ee0651b038b0d50ce2830e77cdce13412") # DigiByte v8.26 muhash
7474

7575
def run_test(self):
7676
self.test_muhash_implementation()

test/functional/rpc_getblockstats.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,18 @@ def run_test(self):
169169

170170
self.log.info('Test block height 0')
171171
genesis_stats = self.nodes[0].getblockstats(0)
172-
assert_equal(genesis_stats["blockhash"], "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")
172+
assert_equal(genesis_stats["blockhash"], "4598a0f2b823aaf9e77ee6d5e46f1edb824191dcd48b08437b7cec17e6ae6e26")
173173
assert_equal(genesis_stats["utxo_increase"], 1)
174-
assert_equal(genesis_stats["utxo_size_inc"], 117)
174+
assert_equal(genesis_stats["utxo_size_inc"], 52)
175175
assert_equal(genesis_stats["utxo_increase_actual"], 0)
176176
assert_equal(genesis_stats["utxo_size_inc_actual"], 0)
177177

178178
self.log.info('Test tip including OP_RETURN')
179179
tip_stats = self.nodes[0].getblockstats(tip)
180-
assert_equal(tip_stats["utxo_increase"], 6)
181-
assert_equal(tip_stats["utxo_size_inc"], 441)
182-
assert_equal(tip_stats["utxo_increase_actual"], 4)
183-
assert_equal(tip_stats["utxo_size_inc_actual"], 300)
180+
assert_equal(tip_stats["utxo_increase"], 2)
181+
assert_equal(tip_stats["utxo_size_inc"], 163)
182+
assert_equal(tip_stats["utxo_increase_actual"], 1)
183+
assert_equal(tip_stats["utxo_size_inc_actual"], 75)
184184

185185
if __name__ == '__main__':
186186
GetblockstatsTest().main()

test/functional/wallet_spend_unconfirmed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def set_test_params(self):
2020
getcontext().prec=9
2121
self.setup_clean_chain = True
2222
self.num_nodes = 1
23-
self.extra_args = [["-dandelion=0"]]
23+
self.extra_args = [["-dandelion=0", "-maxtxfee=10"]] # Allow up to 10 DGB in fees
2424

2525
def setup_and_fund_wallet(self, walletname):
2626
self.nodes[0].createwallet(walletname)
@@ -393,7 +393,7 @@ def test_sibling_tx_bumps_parent(self):
393393
self.log.info("Start test where a high-fee sibling tx bumps the parent")
394394
wallet = self.setup_and_fund_wallet("generous-sibling")
395395

396-
parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=1, fee_rate=11000)
396+
parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=1, fee_rate=10500)
397397
parent_tx = wallet.gettransaction(txid=parent_txid, verbose=True)
398398
self.assert_undershoots_target(parent_tx)
399399

@@ -427,7 +427,7 @@ def test_confirmed_and_unconfirmed_parent(self):
427427
wallet = self.setup_and_fund_wallet("confirmed_and_unconfirmed_wallet")
428428
confirmed_parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=1, fee_rate=self.target_fee_rate)
429429
self.generate(self.nodes[0], 1) # Wallet has two confirmed UTXOs of ~1DGB each
430-
unconfirmed_parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=0.5, fee_rate=0.5*self.target_fee_rate)
430+
unconfirmed_parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=0.5, fee_rate=10500) # Just above minimum
431431

432432
# wallet has one confirmed UTXO of 1DGB and two unconfirmed UTXOs of ~0.5DGB each
433433
ancestor_aware_txid = wallet.sendtoaddress(address=self.def_wallet.getnewaddress(), amount=1.4, fee_rate=self.target_fee_rate)
@@ -469,7 +469,7 @@ def test_external_input_unconfirmed_low(self):
469469

470470
def run_test(self):
471471
self.log.info("Starting UnconfirmedInputTest!")
472-
self.target_fee_rate = 30000 # DigiByte fee rate: Above minimum 10000 sat/kB (Bitcoin uses 30)
472+
self.target_fee_rate = 15000 # DigiByte fee rate: Above minimum 10000 sat/kB but lower to avoid fee limit
473473
self.def_wallet = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
474474
self.generate(self.nodes[0], 110)
475475

0 commit comments

Comments
 (0)