Account inconsistency in regtest with raw Tx #13261

issue tdiesler opened this issue on May 17, 2018
  1. tdiesler commented at 9:00 AM on May 17, 2018: none

    In a simple scenario where Bob pays Marry some BTC sending a signed raw Tx, the accounts / UTOX list show some inconsistency.

    Please note, that at the end only Marry (but Bob no longer) has an UTOX, but the account balances are shown like this

    > listaccounts
    {
      "": 129.99996200,
      "Bob": 10.00000000,
      "Marry": 9.99000000
    }
    

    It seems that Marry got payed from the default account, instead of Bob's account as defined in the raw Tx.

    > generate 101
    
    > importprivkey cVfiZLCWbCm3SWoBAToaCoMuYJJjEw5cR6ifuWQY1a5wadXynGC2 Bob 
    
    > importprivkey cMcT5vjU5UiF2mh8WE6EsD3YdFEuFuUKm6rCcA8UuR9FUS6VLeRx Marry
    
    > listaccounts
    {
      "": 50.00000000,
      "Bob": 0.00000000,
      "Marry": 0.00000000
    }
    
    > getaddressesbyaccount Bob
    [
      "n3ha6rJa8ZS7B4v4vwNWn8CnLHfUYXW1XE",
      "2Mxztt6zTZ7KPHMdPt8iYtSLxQ9FHAPJMns",
      "bcrt1q7d2dzgxmgu4kzpmvrlz306kcffw225ydq2jwm7"
    ]
    
    > getaddressesbyaccount Marry
    [
      "mm2PoHeFncAStYeZJSSTa4bmUVXRa3L6PL",
      "2NCvSGnUTueMFim31cpyw7yp1pKwAyeH4Vj",
      "bcrt1q835lks7r7s7qru78g7uh6l5apr46akde5z5zq2"
    ]
    
    > sendtoaddress n3ha6rJa8ZS7B4v4vwNWn8CnLHfUYXW1XE 10.0
    > generate 1
    > listaccounts
    {
      "": 89.99996200,
      "Bob": 10.00000000,
      "Marry": 0.00000000
    }
    
    > listunspent 1
    [
      ...,
      {
        "txid": "c680f0abc596dfb5cec6dfc44a7ef7e54c2fa0b6557910c67cc4c3474487d37c",
        "vout": 0,
        "address": "n3ha6rJa8ZS7B4v4vwNWn8CnLHfUYXW1XE",
        "account": "Bob",
        "scriptPubKey": "76a914f354d120db472b61076c1fc517ead84a5ca5508d88ac",
        "amount": 10.00000000,
        "confirmations": 1,
        "spendable": true,
        "solvable": true,
        "safe": true
      },
      ...
    ]
    
    > createrawtransaction '[{"txid":"c680f0abc596dfb5cec6dfc44a7ef7e54c2fa0b6557910c67cc4c3474487d37c","vout":0}]' '{"mm2PoHeFncAStYeZJSSTa4bmUVXRa3L6PL":9.99}'
    02000000017cd3874447c3c47cc6107955b6a02f4ce5f77e4ac4dfc6ceb5df96c5abf080c60000000000ffffffff01c0878b3b000000001976a9143c69fb43c3f43c01f3c747b97d7e9d08ebaed9b988ac00000000
    
    > signrawtransaction '02000000017cd3874447c3c47cc6107955b6a02f4ce5f77e4ac4dfc6ceb5df96c5abf080c60000000000ffffffff01c0878b3b000000001976a9143c69fb43c3f43c01f3c747b97d7e9d08ebaed9b988ac00000000' '[{"txid":"c680f0abc596dfb5cec6dfc44a7ef7e54c2fa0b6557910c67cc4c3474487d37c","vout":0, "scriptPubKey":"76a914f354d120db472b61076c1fc517ead84a5ca5508d88ac"}]' '["cVfiZLCWbCm3SWoBAToaCoMuYJJjEw5cR6ifuWQY1a5wadXynGC2"]'
    {
      "hex": "02000000017cd3874447c3c47cc6107955b6a02f4ce5f77e4ac4dfc6ceb5df96c5abf080c6000000006a473044022009fcc3faa221db782d56f1e388979e61d5eb903ec0f16e919051aba631c3bdbf022073be7a8ea3ba73e436f6dd2f4b365131fe4537bbfa0944a73872e15e55f366eb01210389f32f5b1a8339b53308c4ee36bdcaacec27cf74e4138d2b372c8df323c21cf6ffffffff01c0878b3b000000001976a9143c69fb43c3f43c01f3c747b97d7e9d08ebaed9b988ac00000000",
      "complete": true
    }
    
    > sendrawtransaction 02000000017cd3874447c3c47cc6107955b6a02f4ce5f77e4ac4dfc6ceb5df96c5abf080c6000000006a473044022009fcc3faa221db782d56f1e388979e61d5eb903ec0f16e919051aba631c3bdbf022073be7a8ea3ba73e436f6dd2f4b365131fe4537bbfa0944a73872e15e55f366eb01210389f32f5b1a8339b53308c4ee36bdcaacec27cf74e4138d2b372c8df323c21cf6ffffffff01c0878b3b000000001976a9143c69fb43c3f43c01f3c747b97d7e9d08ebaed9b988ac00000000
    > generate 1
    
    > listunspent 1
    [
      {
        "txid": "efcac0dca6a10e9f0a2a89ac34e64309819441dcc2f9553e1d3cf52a333ab939",
        "vout": 0,
        "address": "mqnLRnRoExhUFsP1Y66JLen2h2qXtCw8dF",
        "scriptPubKey": "210340323d67d27e075030ea9c286e078e30ec728b46710952d3e2bb201cca533b24ac",
        "amount": 50.00000000,
        "confirmations": 102,
        "spendable": true,
        "solvable": true,
        "safe": true
      },
      {
        "txid": "fa3a28d1f9136fadb43984e464276b6b2a28443af0a0f73381487a71204a4d44",
        "vout": 0,
        "address": "mm2PoHeFncAStYeZJSSTa4bmUVXRa3L6PL",
        "account": "Marry",
        "scriptPubKey": "76a9143c69fb43c3f43c01f3c747b97d7e9d08ebaed9b988ac",
        "amount": 9.99000000,
        "confirmations": 1,
        "spendable": true,
        "solvable": true,
        "safe": true
      },
      {
        "txid": "c680f0abc596dfb5cec6dfc44a7ef7e54c2fa0b6557910c67cc4c3474487d37c",
        "vout": 1,
        "address": "2NFAvRVEoE7jfVuZQkSgSNZRkEUeUeic3HR",
        "redeemScript": "001406a25b3828b5f9a58940279fb65c72fa3ebf8702",
        "scriptPubKey": "a914f08270c43a050a9faf69dc0bdd3b8e078a48c56987",
        "amount": 39.99996200,
        "confirmations": 2,
        "spendable": true,
        "solvable": true,
        "safe": true
      },
      {
        "txid": "8104c596910e143232dd3f6c94875fe42ef358908575bb87e93830d9db2c77d4",
        "vout": 0,
        "address": "mqnLRnRoExhUFsP1Y66JLen2h2qXtCw8dF",
        "scriptPubKey": "210340323d67d27e075030ea9c286e078e30ec728b46710952d3e2bb201cca533b24ac",
        "amount": 50.00000000,
        "confirmations": 101,
        "spendable": true,
        "solvable": true,
        "safe": true
      }
    ]
    
    > listaccounts
    {
      "": 129.99996200,
      "Bob": 10.00000000,
      "Marry": 9.99000000
    }
    
  2. marcoagner commented at 9:33 AM on May 17, 2018: contributor

    FWIW the account API is being deprecated for v0.17.0 and will be removed on v0.18.0 - which does not invalidate the issue, ofc. Edit: for more info about the deprecation, #12952 and #12953.

  3. ken2812221 commented at 10:14 AM on May 17, 2018: contributor

    Maybe related #12608

  4. sipa commented at 10:22 AM on May 17, 2018: member

    A transaction received from the network (and not issued locally by any of the RPC commands) will always deduct the "" account - there is no way to guess which account was intended to be deducted.

    Addresses associated with accounts define which account gets credited for incoming payments. But deducting always has to be specified explicitly.

    This is just one of the many problems with the account system, and it's being deprecated and removed in upcoming versions.

  5. MarcoFalke closed this on May 17, 2018

  6. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me