Skip to content

Commit 6d80349

Browse files
committed
Don't show addresses or P2PK in decoderawtransaction
1 parent e00ecb3 commit 6d80349

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/core_write.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_address)
144144
out.pushKV("type", GetTxnOutputType(type));
145145

146146
CTxDestination address;
147-
if (include_address && ExtractDestination(script, address)) {
147+
if (include_address && ExtractDestination(script, address) && type != TX_PUBKEY) {
148148
out.pushKV("address", EncodeDestination(address));
149149
}
150150
}
@@ -160,7 +160,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
160160
if (fIncludeHex)
161161
out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
162162

163-
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
163+
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || type == TX_PUBKEY) {
164164
out.pushKV("type", GetTxnOutputType(type));
165165
return;
166166
}

test/util/data/txcreateoutpubkey1.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
"scriptPubKey": {
1616
"asm": "02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 OP_CHECKSIG",
1717
"hex": "2102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac",
18-
"reqSigs": 1,
19-
"type": "pubkey",
20-
"addresses": [
21-
"1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz"
22-
]
18+
"type": "pubkey"
2319
}
2420
}
2521
],

0 commit comments

Comments
 (0)