Skip to content

Commit a6ddb19

Browse files
committed
Merge #7687: Stop treating importaddress'ed scripts as change
595b22e Stop treating importaddress'ed scripts as change (Pieter Wuille)
2 parents 65c2058 + 595b22e commit a6ddb19

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wallet/rpcdump.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ void ImportScript(const CScript& script, const string& strLabel, bool isRedeemSc
167167
if (!pwalletMain->HaveCScript(script) && !pwalletMain->AddCScript(script))
168168
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet");
169169
ImportAddress(CBitcoinAddress(CScriptID(script)), strLabel);
170+
} else {
171+
CTxDestination destination;
172+
if (ExtractDestination(script, destination)) {
173+
pwalletMain->SetAddressBook(destination, strLabel, "receive");
174+
}
170175
}
171176
}
172177

@@ -195,6 +200,8 @@ UniValue importaddress(const UniValue& params, bool fHelp)
195200
"4. p2sh (boolean, optional, default=false) Add the P2SH version of the script as well\n"
196201
"\nNote: This call can take minutes to complete if rescan is true.\n"
197202
"If you have the full public key, you should call importpubkey instead of this.\n"
203+
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
204+
"as change, and not show up in many RPCs.\n"
198205
"\nExamples:\n"
199206
"\nImport a script with rescan\n"
200207
+ HelpExampleCli("importaddress", "\"myscript\"") +

0 commit comments

Comments
 (0)