Improve likeness with bitcoind getrawtransaction
Created by: dagurval
The electrum specification for verbose transaction is as follows:
The result is a coin-specific dictionary – whatever the coin daemon returns when asked for a verbose form of the raw transaction.
In other words, it's undefined. In addition the performance of fetching the details from bitcoind is much worse that just creating it ourselves, as we can do so from the data in our transaction cache. This is also what ElectrsCash does.
This PR makes the output more like what we'd expect from any bitcoind, be it BU, BCHN or others. This is a breaking change.
The following changes have been made:
-
txout -> value
should not return satoshis, but as coins (/ 100 000 000
). However, just changing the unit is dangerous, as we don't know what applications expect satoshis now. It's better to break these by removing the field. This field has been split intotxout -> value_satoshi
andtxout -> value_coin
. Thevalue
field is scheduled to be re-added in 6 months. -
txout -> scriptPubKey
is now an object with fieldshex
,asm
andtype
, rather than a hex string. -
txout -> n
is added. -
txin -> scriptSig
is now an object with fieldshex
andasm
Test plan
- Test added to elecrum_transaction_get.py
./contrib/run_functional_tests.sh
Thanks to Sahid Miller from electrum-cash telegram for reporting incompatibility issues.