[wallet, rpc tests] Fix settxfee, paytxfee #7103

Merged
merged 2 commits into from Nov 30, 2015

Conversation

Projects
None yet
4 participants
@MarcoFalke
Member

MarcoFalke commented Nov 26, 2015

This comes without the GUI changes, so it should be easier to review and backport. GUI: #7096

@laanwj

View changes

qa/rpc-tests/wallet.py
#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'))

This comment has been minimized.

@laanwj

laanwj Nov 26, 2015

Member

Does removing the extra zeroes here make any difference?

@laanwj

laanwj Nov 26, 2015

Member

Does removing the extra zeroes here make any difference?

This comment has been minimized.

@MarcoFalke

MarcoFalke Nov 26, 2015

Member
>>> Decimal("0.100") == Decimal(".1")
True

But the diff is larger. So removed this.

@MarcoFalke

MarcoFalke Nov 26, 2015

Member
>>> 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))

This comment has been minimized.

@jonasschnelli

jonasschnelli Nov 26, 2015

Member

hmm.. is forming a byte arrayreally necessary? Would len(hex_string)/2 not be sufficient?

@jonasschnelli

jonasschnelli Nov 26, 2015

Member

hmm.. is forming a byte arrayreally necessary? Would len(hex_string)/2 not be sufficient?

This comment has been minimized.

@laanwj

laanwj Nov 26, 2015

Member

I considered that nit, but right now it checks it is a valid hex string, which is kind of useful for a test

@laanwj

laanwj Nov 26, 2015

Member

I considered that nit, but right now it checks it is a valid hex string, which is kind of useful for a test

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Nov 26, 2015

Member

Tested ACK.

Works (tx size 373 bytes, txfeerate is 0.01, fee = 0.00373):

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).

Member

jonasschnelli commented Nov 26, 2015

Tested ACK.

Works (tx size 373 bytes, txfeerate is 0.01, fee = 0.00373):

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).

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Nov 26, 2015

Member

utACK

Member

sipa commented Nov 26, 2015

utACK

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Nov 26, 2015

Member

utACK

Member

laanwj commented Nov 26, 2015

utACK

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Nov 27, 2015

Member

@gmaxwell can you take a look here too

Member

laanwj commented Nov 27, 2015

@gmaxwell can you take a look here too

@laanwj laanwj added this to the 0.12.0 milestone Nov 27, 2015

Ryan Havar and others added some commits Sep 7, 2015

Default fPayAtLeastCustomFee to false
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
@MarcoFalke

This comment has been minimized.

Show comment
Hide comment
@MarcoFalke

MarcoFalke Nov 28, 2015

Member

Trivial rebase. (Previous head: fa895cb)

Member

MarcoFalke commented Nov 28, 2015

Trivial rebase. (Previous head: fa895cb)

@laanwj laanwj merged commit fa506c0 into bitcoin:master Nov 30, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Nov 30, 2015

Merge pull request #7103
fa506c0 [wallet] Add rpc tests to verify fee calculations (MarcoFalke)
4b89f01 Default fPayAtLeastCustomFee to false (Ryan Havar)

@MarcoFalke MarcoFalke deleted the MarcoFalke:FixSettxfee branch Nov 30, 2015

@str4d str4d referenced this pull request in zcash/zcash Mar 29, 2017

Open

Bitcoin 0.12 wallet PRs 1 #2225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment