Browse Source

Update bitcoin-tx to output witness data.

0.14
jonnynewbs 8 years ago committed by jnewbery
parent
commit
4408558843
  1. 11
      src/core_write.cpp
  2. 1
      src/test/data/blanktx.json
  3. 1
      src/test/data/tt-delin1-out.json
  4. 1
      src/test/data/tt-delout1-out.json
  5. 1
      src/test/data/tt-locktime317000-out.json
  6. 1
      src/test/data/txcreate1.json
  7. 1
      src/test/data/txcreate2.json
  8. 1
      src/test/data/txcreatedata1.json
  9. 1
      src/test/data/txcreatedata2.json
  10. 1
      src/test/data/txcreatedata_seq0.json
  11. 1
      src/test/data/txcreatedata_seq1.json
  12. 1
      src/test/data/txcreatesign.json

11
src/core_write.cpp

@ -151,11 +151,13 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry) void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
{ {
entry.pushKV("txid", tx.GetHash().GetHex()); entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
entry.pushKV("version", tx.nVersion); entry.pushKV("version", tx.nVersion);
entry.pushKV("locktime", (int64_t)tx.nLockTime); entry.pushKV("locktime", (int64_t)tx.nLockTime);
UniValue vin(UniValue::VARR); UniValue vin(UniValue::VARR);
BOOST_FOREACH(const CTxIn& txin, tx.vin) { for (unsigned int i = 0; i < tx.vin.size(); i++) {
const CTxIn& txin = tx.vin[i];
UniValue in(UniValue::VOBJ); UniValue in(UniValue::VOBJ);
if (tx.IsCoinBase()) if (tx.IsCoinBase())
in.pushKV("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())); in.pushKV("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
@ -166,6 +168,13 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
o.pushKV("asm", ScriptToAsmStr(txin.scriptSig, true)); o.pushKV("asm", ScriptToAsmStr(txin.scriptSig, true));
o.pushKV("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())); o.pushKV("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
in.pushKV("scriptSig", o); in.pushKV("scriptSig", o);
if (!tx.wit.IsNull() && i < tx.wit.vtxinwit.size() && !tx.wit.vtxinwit[i].IsNull()) {
UniValue txinwitness(UniValue::VARR);
for (const auto& item : tx.wit.vtxinwit[i].scriptWitness.stack) {
txinwitness.push_back(HexStr(item.begin(), item.end()));
}
in.pushKV("txinwitness", txinwitness);
}
} }
in.pushKV("sequence", (int64_t)txin.nSequence); in.pushKV("sequence", (int64_t)txin.nSequence);
vin.push_back(in); vin.push_back(in);

1
src/test/data/blanktx.json

@ -1,5 +1,6 @@
{ {
"txid": "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43", "txid": "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43",
"hash": "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/tt-delin1-out.json

@ -1,5 +1,6 @@
{ {
"txid": "81b2035be1da1abe745c6141174a73d151009ec17b3d5ebffa2e177408c50dfd", "txid": "81b2035be1da1abe745c6141174a73d151009ec17b3d5ebffa2e177408c50dfd",
"hash": "81b2035be1da1abe745c6141174a73d151009ec17b3d5ebffa2e177408c50dfd",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/tt-delout1-out.json

@ -1,5 +1,6 @@
{ {
"txid": "c46ccd75b5050e942b2e86a3648f843f525fe6fc000bf0534ba5973063354493", "txid": "c46ccd75b5050e942b2e86a3648f843f525fe6fc000bf0534ba5973063354493",
"hash": "c46ccd75b5050e942b2e86a3648f843f525fe6fc000bf0534ba5973063354493",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/tt-locktime317000-out.json

@ -1,5 +1,6 @@
{ {
"txid": "aded538f642c17e15f4d3306b8be7e1a4d1ae0c4616d641ab51ea09ba65e5cb5", "txid": "aded538f642c17e15f4d3306b8be7e1a4d1ae0c4616d641ab51ea09ba65e5cb5",
"hash": "aded538f642c17e15f4d3306b8be7e1a4d1ae0c4616d641ab51ea09ba65e5cb5",
"version": 1, "version": 1,
"locktime": 317000, "locktime": 317000,
"vin": [ "vin": [

1
src/test/data/txcreate1.json

@ -1,5 +1,6 @@
{ {
"txid": "f70f0d6c71416ed538e37549f430ab3665fee2437a42f10238c1bd490e782231", "txid": "f70f0d6c71416ed538e37549f430ab3665fee2437a42f10238c1bd490e782231",
"hash": "f70f0d6c71416ed538e37549f430ab3665fee2437a42f10238c1bd490e782231",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreate2.json

@ -1,5 +1,6 @@
{ {
"txid": "cf90229625e9eb10f6be8156bf6aa5ec2eca19a42b1e05c11f3029b560a32e13", "txid": "cf90229625e9eb10f6be8156bf6aa5ec2eca19a42b1e05c11f3029b560a32e13",
"hash": "cf90229625e9eb10f6be8156bf6aa5ec2eca19a42b1e05c11f3029b560a32e13",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreatedata1.json

@ -1,5 +1,6 @@
{ {
"txid": "07894b4d12fe7853dd911402db1620920d261b9627c447f931417d330c25f06e", "txid": "07894b4d12fe7853dd911402db1620920d261b9627c447f931417d330c25f06e",
"hash": "07894b4d12fe7853dd911402db1620920d261b9627c447f931417d330c25f06e",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreatedata2.json

@ -1,5 +1,6 @@
{ {
"txid": "4ed17118f5e932ba8c75c461787d171bc02a016d8557cb5bcf34cd416c27bb8b", "txid": "4ed17118f5e932ba8c75c461787d171bc02a016d8557cb5bcf34cd416c27bb8b",
"hash": "4ed17118f5e932ba8c75c461787d171bc02a016d8557cb5bcf34cd416c27bb8b",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreatedata_seq0.json

@ -1,5 +1,6 @@
{ {
"txid": "71603ccb1cd76d73d76eb6cfd5f0b9df6d65d90d76860ee52cb461c4be7032e8", "txid": "71603ccb1cd76d73d76eb6cfd5f0b9df6d65d90d76860ee52cb461c4be7032e8",
"hash": "71603ccb1cd76d73d76eb6cfd5f0b9df6d65d90d76860ee52cb461c4be7032e8",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreatedata_seq1.json

@ -1,5 +1,6 @@
{ {
"txid": "c4dea671b0d7b48f8ab10bc46650e8329d3c5766931f548f513847a19f5ba75b", "txid": "c4dea671b0d7b48f8ab10bc46650e8329d3c5766931f548f513847a19f5ba75b",
"hash": "c4dea671b0d7b48f8ab10bc46650e8329d3c5766931f548f513847a19f5ba75b",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

1
src/test/data/txcreatesign.json

@ -1,5 +1,6 @@
{ {
"txid": "977e7cd286cb72cd470d539ba6cb48400f8f387d97451d45cdb8819437a303af", "txid": "977e7cd286cb72cd470d539ba6cb48400f8f387d97451d45cdb8819437a303af",
"hash": "977e7cd286cb72cd470d539ba6cb48400f8f387d97451d45cdb8819437a303af",
"version": 1, "version": 1,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [

Loading…
Cancel
Save