test: Run mempool_accept.py even with wallet disabled #21014
test: Run mempool_accept.py even with wallet disabled #21014stackman27 wants to merge 2 commits intobitcoin:masterfrom
Conversation
|
Concept ACK Can you squash your commits @stackman27? |
e585692 to
ce45bd6
Compare
Yes! Should be fine now :) |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
ce45bd6 to
4501022
Compare
4501022 to
27f078c
Compare
27f078c to
582d57c
Compare
582d57c to
f37a517
Compare
DariusParvin
left a comment
There was a problem hiding this comment.
Looks good! The only thing is I think having a separate create_self_transfer method would be more straightforward than having a send_tx flag in send_self_transfer. With the send_tx flag, it also becomes a bit ambiguous whether the new utxo has been appended to the list of spendable utxos when send_tx = False.
There was a problem hiding this comment.
It seems like it might be misleading to have a method whose name is send_self_transfer, but then have a flag to say send = False.
Instead, maybe it would be more straightforward to have a separate method create_self_transfer, that returns the tx hex. This function could be used within send_self_transfer to create the transaction before broadcasting it.
I'm about to submit a PR for another test where I had a go at doing it this way.
There was a problem hiding this comment.
That totally makes sense! or maybe we can simply rename the method to something that mimics it's accurate behavior, something in the lines of sign_or_send_self_transfer. Would love to hear @MarcoFalke's thoughts on this
91c2848 to
311a6f7
Compare
311a6f7 to
5ed2bde
Compare
glozow
left a comment
There was a problem hiding this comment.
A few comments
Also on style - from PEP8: "Don't use spaces around the = sign when used to indicate a keyword argument, or when used to indicate a default value for an unannotated function parameter"
| return self._utxos.pop(index) | ||
|
|
||
| def send_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None): | ||
| def send_self_transfer(self, *, fee_rate=Decimal("0.003"), seq_num = 0xffffffff, from_node, utxo_to_spend=None, send_tx = True, nVersion = 1, default_fee = False): |
There was a problem hiding this comment.
Since it's optional
| def send_self_transfer(self, *, fee_rate=Decimal("0.003"), seq_num = 0xffffffff, from_node, utxo_to_spend=None, send_tx = True, nVersion = 1, default_fee = False): | |
| def send_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None, send_tx=True, nVersion=1, seq_num=0xffffffff, default_fee=False): |
| self._utxos.append({'txid': tx_info['txid'], 'vout': 0, 'value': send_value}) | ||
| from_node.sendrawtransaction(tx_hex) | ||
| if send_tx: | ||
| if default_fee: |
There was a problem hiding this comment.
This should be called bypass_maxfeerate. But really, since it's a parameter for sendrawtransaction, why isn't the caller doing a send_tx=False and then submitting it themselves?
There was a problem hiding this comment.
So this was following Darius's comment. I could only append tx in self.utxos after sending a transaction. If I try to simply send transaction from somewhere else, I wouldn't be able to append it in the internal wallet.py list
| tx.vin = [CTxIn(COutPoint(int(utxo_to_spend['txid'], 16), utxo_to_spend['vout']))] | ||
| tx.vin = [CTxIn(COutPoint(int(utxo_to_spend['txid'], 16), utxo_to_spend['vout']), nSequence = seq_num)] | ||
| tx.vout = [CTxOut(int(send_value * COIN), self._scriptPubKey)] | ||
| tx.nVersion = 2 |
There was a problem hiding this comment.
You're accepting a nVersion param but not using it?
| inputs=[{"txid": txid_in_block, "vout": 0, "sequence": BIP125_SEQUENCE_NUMBER}], # RBF is used later | ||
| outputs=[{node.getnewaddress(): Decimal('0.3') - fee}], | ||
| ))['hex'] | ||
| fee = Decimal('0.00000672') |
There was a problem hiding this comment.
Yea cause the previous fee of fee = Decimal('0.000007') was too low to pass the mempool test. I manually calculated the fee here fee_rate = Decimal('0.00007672') - fee,, to get the best option
| self.log.info('Start with empty mempool, and 200 blocks') | ||
| self.mempool_size = 0 | ||
| miniwallet.generate(10) | ||
| node.generate(190) |
There was a problem hiding this comment.
Assuming this is done to mature the coinbases... is there any reason to do more than 100?
There was a problem hiding this comment.
Not really, just wanted to keep 200 blocks to mimic the current code
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
Are you still working on this? Otherwise someone else could pick this up. |
|
Picked up in #22509 |
This is a PR proposed in #20078
This PR enables one more of the non-wallet functional tests (mempool_accept.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead.
This PR also includes changes on
wallet.pyto accommodate some of the features used inmempool_accept.pylike explicitly statingnSequencefor RBF and sending tx withmax fee = 0