revault / revaultd

The "wallet" daemon for participants under the Revault architecture
BSD 3-Clause "New" or "Revised" License
48 stars 21 forks source link

Change getspendtx response of ListSpendtxEntry #408

Closed edouardparis closed 2 years ago

edouardparis commented 2 years ago

for https://github.com/revault/revault-gui/issues/358 Some information are needed. User cannot use listspendtx because at this step of the spend tx creation, the transaction is not yet saved in the database

darosior commented 2 years ago
        revault_network.activate_vault(vault_b)
        spend_tx_b = man.rpc.getspendtx(spent_vaults, destination, feerate)["spend_tx"][
            "psbt"
        ]
        man.rpc.updatespendtx(spend_tx_b)
        man.wait_for_log("Storing new Spend transaction")
        spend_txs = man.rpc.listspendtxs()["spend_txs"]
        assert len(spend_txs) == 2
        assert {
            "deposit_outpoints": [deposit],
            "deposit_amount": vault["amount"],
            "cpfp_amount": 48224,
            "psbt": spend_tx,
            "change_index": None,
            "cpfp_index": 0,
            "status": "non_final",
        } in spend_txs
>       assert {
            "deposit_outpoints": [deposit, deposit_b],
            "deposit_amount": vault["amount"] + vault_b["amount"],
            "cpfp_amount": 95808,
            "psbt": spend_tx_b,
            "change_index": 3,
            "cpfp_index": 0,
            "status": "non_final",
        } in spend_txs
E       AssertionError: assert {'change_index': 3, 'cpfp_amount': 95808, 'cpfp_index': 0, 'deposit_amount': 48000000, ...} in [{'change_index': 3, 'cpfp_amount': 95808, 'cpfp_index': 0, 'deposit_amount': 48000000, ...}, {'change_index': None, 'cpfp_amount': 48224, 'cpfp_index': 0, 'deposit_amount': 24000000, ...}]

tests/test_spend.py:106: AssertionError
---------------------------- Captured stdout setup -----------------------------
Running tests in /tmp/revaultd-tests-fcks3h8u
------------------------------ Captured log setup ------------------------------
INFO     root:bitcoind.py:82 BitcoinD started
----------------------------- Captured stderr call -----------------------------
   Compiling cc v1.0.67
   Compiling serde v1.0.125
   Compiling libc v0.2.94
   Compiling bitcoin_hashes v0.10.0
   Compiling ryu v1.0.5
   Compiling bech32 v0.8.1
   Compiling serde_json v1.0.64
   Compiling itoa v0.4.7
   Compiling base64 v0.13.0
   Compiling secp256k1-sys v0.4.0
   Compiling bitcoinconsensus v0.19.0-3
   Compiling secp256k1 v0.20.2
   Compiling bitcoin v0.27.1
   Compiling miniscript v6.0.1
   Compiling revault_tx v0.4.0 (https://github.com/danielabrozzoni/revault_tx/?branch=2021109_support_cpfp#2870c7b1)
   Compiling mscompiler v0.0.1 (/tmp/cirrus-ci-build/contrib/tools/mscompiler)
    Finished dev [unoptimized + debuginfo] target(s) in 33.04s
--------------------------- Captured stdout teardown ---------------------------
Test failed, leaving directory '/tmp/revaultd-tests-fcks3h8u/test_spendtx_management_1' intact
=========================== short test summary info ============================
FAILED tests/test_spend.py::test_spendtx_management - AssertionError: assert ...
=================== 1 failed, 7 passed in 1364.60s (0:22:44) ===================