Skip to content

Commit d2c3b7e

Browse files
laanwjcodablock
authored andcommitted
Merge bitcoin#7687: Stop treating importaddress'ed scripts as change
595b22e Stop treating importaddress'ed scripts as change (Pieter Wuille)
1 parent 782745b commit d2c3b7e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/wallet/rpcdump.cpp

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

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

0 commit comments

Comments
 (0)