Page MenuHomePhabricator

[rpc] add send method
ClosedPublic

Authored by PiRK on Wed, Oct 6, 11:22.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCd044621ed44f: [rpc] add send method
Summary

This is a backport of [[https://github.com/bitcoin/bitcoin/pull/16378 | core#16378]] [3/3]
https://github.com/bitcoin/bitcoin/pull/16378/commits/92326d89766155a792254d30a9962251b8fc7799

Depends on D10264

Backport differences:

  • Arguments conf_target and estimate_mode, as well as the options of the same name are removed. The option fee_rate can be used to set the fee. The RPCExamples are updated accordingly.
  • Options change_type and replaceable are removed.
  • The functional test sets the fee rate with fee_rate option, so the unit is XEC/kB instead of sat/B.
  • In the test, I did not set decimal.getcontext().prec = 2, because this causes a suprising loss of precision that makes somes checks fail:
>>> from decimal import getcontext, Decimal
>>> getcontext().prec = 2
>>> Decimal("1329999995.50") - Decimal("1328999993.25")
Decimal('1.0E+6')
Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Wed, Oct 6, 11:23

Failed tests logs:

====== Bitcoin ABC functional tests: wallet_send.py ======

------- Stdout: -------
2021-10-06T11:39:00.178000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20211006_113349/wallet_send_178
2021-10-06T11:39:00.886000Z TestFramework (INFO): Setup wallets...
2021-10-06T11:39:02.290000Z TestFramework (INFO): Send to address...
2021-10-06T11:39:04.408000Z TestFramework (INFO): Don't broadcast...
2021-10-06T11:39:04.461000Z TestFramework (INFO): Return PSBT...
2021-10-06T11:39:04.510000Z TestFramework (INFO): Create transaction that spends to address, but don't broadcast...
2021-10-06T11:39:04.589000Z TestFramework (INFO): Create PSBT from watch-only wallet w3, sign with w2...
2021-10-06T11:39:04.635000Z TestFramework (INFO): Create PSBT from wallet w4 with watch-only keys, sign with w2...
ploup (-4, 'Insufficient funds')
2021-10-06T11:39:04.753000Z TestFramework (INFO): Create OP_RETURN...
ploup (-8, "Data must be hexadecimal string (not 'Hello World')")
2021-10-06T11:39:05.936000Z TestFramework (INFO): Set fee rate...
2021-10-06T11:39:05.946000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 128, in main
    self.run_test()
  File "/work/test/functional/wallet_send.py", line 297, in run_test
    add_to_wallet=False)
  File "/work/test/functional/wallet_send.py", line 88, in test_send
    options=options)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 163, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: Use fee_rate (-8)
2021-10-06T11:39:05.997000Z TestFramework (INFO): Stopping nodes
2021-10-06T11:39:06.199000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20211006_113349/wallet_send_178
2021-10-06T11:39:06.199000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20211006_113349/wallet_send_178/test_framework.log
2021-10-06T11:39:06.199000Z TestFramework (ERROR): 
2021-10-06T11:39:06.199000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20211006_113349/wallet_send_178' to consolidate all logs
2021-10-06T11:39:06.199000Z TestFramework (ERROR): 
2021-10-06T11:39:06.199000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-10-06T11:39:06.199000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-10-06T11:39:06.199000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: wallet_send.py

Failed tests logs:

====== Bitcoin ABC functional tests: wallet_send.py ======

------- Stdout: -------
2021-10-06T11:41:03.537000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_113734/wallet_send_178
2021-10-06T11:41:03.935000Z TestFramework (INFO): Setup wallets...
2021-10-06T11:41:05.239000Z TestFramework (INFO): Send to address...
2021-10-06T11:41:07.360000Z TestFramework (INFO): Don't broadcast...
2021-10-06T11:41:07.411000Z TestFramework (INFO): Return PSBT...
2021-10-06T11:41:07.432000Z TestFramework (INFO): Create transaction that spends to address, but don't broadcast...
2021-10-06T11:41:07.493000Z TestFramework (INFO): Create PSBT from watch-only wallet w3, sign with w2...
2021-10-06T11:41:07.539000Z TestFramework (INFO): Create PSBT from wallet w4 with watch-only keys, sign with w2...
ploup (-4, 'Insufficient funds')
2021-10-06T11:41:07.599000Z TestFramework (INFO): Create OP_RETURN...
ploup (-8, "Data must be hexadecimal string (not 'Hello World')")
2021-10-06T11:41:08.761000Z TestFramework (INFO): Set fee rate...
2021-10-06T11:41:08.777000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 128, in main
    self.run_test()
  File "/work/test/functional/wallet_send.py", line 297, in run_test
    add_to_wallet=False)
  File "/work/test/functional/wallet_send.py", line 88, in test_send
    options=options)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 163, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: Use fee_rate (-8)
2021-10-06T11:41:08.830000Z TestFramework (INFO): Stopping nodes
2021-10-06T11:41:09.339000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_113734/wallet_send_178
2021-10-06T11:41:09.340000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_113734/wallet_send_178/test_framework.log
2021-10-06T11:41:09.340000Z TestFramework (ERROR): 
2021-10-06T11:41:09.340000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_113734/wallet_send_178' to consolidate all logs
2021-10-06T11:41:09.341000Z TestFramework (ERROR): 
2021-10-06T11:41:09.341000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-10-06T11:41:09.341000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-10-06T11:41:09.341000Z TestFramework (ERROR):
====== Bitcoin ABC functional tests with the next upgrade activated: wallet_send.py ======

------- Stdout: -------
2021-10-06T11:44:32.555000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_114109/wallet_send_178
2021-10-06T11:44:32.973000Z TestFramework (INFO): Setup wallets...
2021-10-06T11:44:33.180000Z TestFramework (INFO): Send to address...
2021-10-06T11:44:35.282000Z TestFramework (INFO): Don't broadcast...
2021-10-06T11:44:35.324000Z TestFramework (INFO): Return PSBT...
2021-10-06T11:44:35.371000Z TestFramework (INFO): Create transaction that spends to address, but don't broadcast...
2021-10-06T11:44:35.392000Z TestFramework (INFO): Create PSBT from watch-only wallet w3, sign with w2...
2021-10-06T11:44:35.410000Z TestFramework (INFO): Create PSBT from wallet w4 with watch-only keys, sign with w2...
ploup (-4, 'Insufficient funds')
2021-10-06T11:44:35.459000Z TestFramework (INFO): Create OP_RETURN...
ploup (-8, "Data must be hexadecimal string (not 'Hello World')")
2021-10-06T11:44:36.614000Z TestFramework (INFO): Set fee rate...
2021-10-06T11:44:36.629000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 128, in main
    self.run_test()
  File "/work/test/functional/wallet_send.py", line 297, in run_test
    add_to_wallet=False)
  File "/work/test/functional/wallet_send.py", line 88, in test_send
    options=options)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 163, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: Use fee_rate (-8)
2021-10-06T11:44:36.683000Z TestFramework (INFO): Stopping nodes
2021-10-06T11:44:36.838000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_114109/wallet_send_178
2021-10-06T11:44:36.839000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_114109/wallet_send_178/test_framework.log
2021-10-06T11:44:36.839000Z TestFramework (ERROR): 
2021-10-06T11:44:36.839000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20211006_114109/wallet_send_178' to consolidate all logs
2021-10-06T11:44:36.839000Z TestFramework (ERROR): 
2021-10-06T11:44:36.839000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-10-06T11:44:36.839000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-10-06T11:44:36.839000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: wallet_send.py
Bitcoin ABC functional tests with the next upgrade activated: wallet_send.py

PiRK planned changes to this revision.Wed, Oct 6, 11:51

something went wrong when rebasing after changing feeRate -> fee_rate in the previous commit

PiRK edited the summary of this revision. (Show Details)

use fee_rate in the test now that D10264 is fixed to recognize the option.
Remove a few debbugging print.

Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/wallet/rpcwallet.cpp
3708 ↗(On Diff #30338)

See D10264

4729 ↗(On Diff #30338)

Move the comment on its own line

This revision is now accepted and ready to land.Wed, Oct 6, 14:52

rebase for release-notes.md

This revision was automatically updated to reflect the committed changes.