From 6d803494b59ab5520079b6a72d97790d86d2a015 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Mon, 26 Aug 2019 17:32:47 +0900 Subject: [PATCH] Don't show addresses or P2PK in decoderawtransaction --- src/core_write.cpp | 4 ++-- test/util/data/txcreateoutpubkey1.json | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core_write.cpp b/src/core_write.cpp index 4d64446d7b8..7ce2a498364 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -144,7 +144,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_address) out.pushKV("type", GetTxnOutputType(type)); CTxDestination address; - if (include_address && ExtractDestination(script, address)) { + if (include_address && ExtractDestination(script, address) && type != TX_PUBKEY) { out.pushKV("address", EncodeDestination(address)); } } @@ -160,7 +160,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey, if (fIncludeHex) out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())); - if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { + if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || type == TX_PUBKEY) { out.pushKV("type", GetTxnOutputType(type)); return; } diff --git a/test/util/data/txcreateoutpubkey1.json b/test/util/data/txcreateoutpubkey1.json index 32097b3ebe2..42b519bb215 100644 --- a/test/util/data/txcreateoutpubkey1.json +++ b/test/util/data/txcreateoutpubkey1.json @@ -15,11 +15,7 @@ "scriptPubKey": { "asm": "02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 OP_CHECKSIG", "hex": "2102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac", - "reqSigs": 1, - "type": "pubkey", - "addresses": [ - "1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz" - ] + "type": "pubkey" } } ],