Skip to content

Commit

Permalink
fixup! rpc: Add name_autoregister RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmaani committed Jun 23, 2021
1 parent a47951d commit 8d411a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/wallet/rpcnames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,16 @@ name_autoregister()

// TODO: Mark all inputs unspendable.

for (auto input : mtx.vin)
pwallet->LockCoin(input.prevout);

CTransactionRef txr = MakeTransactionRef(mtx);
pwallet->CommitTransaction(txr, {}, {});

pwallet->AddToWallet(txr, /* confirm */ {}, /* update_wtx */ nullptr, /* fFlushOnClose */ true);
// If the transaction is not added to the wallet, the inputs will continue to
// be considered spendable, causing us to double-spend the most preferable input if delegating.

const bool queued_ok = pwallet->WriteQueuedTransaction(mtx.GetHash(), mtx);
if (!queued_ok)
throw JSONRPCError(RPC_WALLET_ERROR, "Error queueing transaction");
Expand Down

0 comments on commit 8d411a1

Please sign in to comment.