New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wallet, rpc tests] Fix settxfee, paytxfee #7103
Conversation
|
||
#check if JSON parser can handle scientific notation in strings | ||
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1e-4") | ||
txObj = self.nodes[0].gettransaction(txId) | ||
assert_equal(txObj['amount'], Decimal('-0.00010000')) | ||
assert_equal(txObj['amount'], Decimal('-0.0001')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does removing the extra zeroes here make any difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> Decimal("0.100") == Decimal(".1")
True
But the diff is larger. So removed this.
@@ -67,6 +67,9 @@ def check_json_precision(): | |||
if satoshis != 2000000000000003: | |||
raise RuntimeError("JSON encode/decode loses precision") | |||
|
|||
def count_bytes(hex_string): | |||
return len(bytearray.fromhex(hex_string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm.. is forming a byte arrayreally necessary? Would len(hex_string)/2
not be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that nit, but right now it checks it is a valid hex string, which is kind of useful for a test
Tested ACK. Works (tx size 373 bytes, txfeerate is 0.01, fee = Jonass-MacBook-Pro:_bitcoin jonasschnelli$ ./src/bitcoin-cli --regtest getbalance
47.98861600
Jonass-MacBook-Pro:_bitcoin jonasschnelli$ ./src/bitcoin-cli --regtest settxfee 0.01
true
Jonass-MacBook-Pro:_bitcoin jonasschnelli$ ./src/bitcoin-cli --regtest getnewaddress
n1YGgjMuRDCEL9PDoMXKeEMzE4Z5gYNHKC
Jonass-MacBook-Pro:_bitcoin jonasschnelli$ ./src/bitcoin-cli --regtest sendtoaddress n1YGgjMuRDCEL9PDoMXKeEMzE4Z5gYNHKC 1.0
ccfb9f516f7935fe53d8c8dfbda2ba9f573a516da465124d4a3f02e9afb1c009
Jonass-MacBook-Pro:_bitcoin jonasschnelli$ ./src/bitcoin-cli --regtest gettransaction ccfb9f516f7935fe53d8c8dfbda2ba9f573a516da465124d4a3f02e9afb1c009
{
"amount": 0.00000000,
"fee": -0.00373000,
"confirmations": 0,
"txid": "ccfb9f516f7935fe53d8c8dfbda2ba9f573a516da465124d4a3f02e9afb1c009",
"walletconflicts": [
],
"time": 1448546094,
"timereceived": 1448546094,
"details": [
{
"account": "",
"address": "n1YGgjMuRDCEL9PDoMXKeEMzE4Z5gYNHKC",
"category": "send",
"amount": -1.00000000,
"label": "",
"vout": 1,
"fee": -0.00373000
},
{
"account": "",
"address": "n1YGgjMuRDCEL9PDoMXKeEMzE4Z5gYNHKC",
"category": "receive",
"amount": 1.00000000,
"label": "",
"vout": 1
}
],
"hex": "0100000002194adfb873b92507d4004b34910ea2e48f673be6c2d46b2408123e59b581f043000000006a47304402203bc41e34daa2ec5f795c38ef31c6d6fe926682609ebaca41ad50867b810d49b902203028f9334df4415da1f0c12ce76211c70583e853e3bb3158508b973b1b659ab4012102d9ce185100c65ba09aaf0d634fb86632ad73a54ff510f833e00348f4bb9edc47feffffff194adfb873b92507d4004b34910ea2e48f673be6c2d46b2408123e59b581f043010000006b483045022100e7fd9fc3a9e0d3ca6e8724e3daf330a1afe5de801e58c5f2193aaed25723d24d0220503460a151301d304f00b6d16364c9cb128e0005eda24950d6436a5b23a86baf01210339167b46e7774585f439d4780919e2dee5af9023cdef4778e245aa40c7650a04feffffff02e09def05000000001976a914d8d20ef3bdd8a263461b5463673cb901716bd88288ac00e1f505000000001976a914dba2489ddc1bfc465632141b8c5e1f3e1fd4a16888ac5b000000"
} Tested also together with the UI (known bug/interference still behaves likes expected). |
utACK |
1 similar comment
utACK |
@gmaxwell can you take a look here too |
This allows for much finer control of the transaction fees per kilobyte as it prevent small transactions using a fee that is more appropriate for one that is of a kilobyte. This also allows controlling the fee per kilobyte over rpc such that: bitcoin-cli settxfee `bitcoin-cli estimatefee 2` would make sense, while currently it grossly fails often by a factor of x3
Trivial rebase. (Previous head: fa895cb) |
This comes without the GUI changes, so it should be easier to review and backport. GUI: #7096