MCPcopy Create free account
hub / github.com/ElementsProject/elements / AddKeypoolPubkeyWithDB

Method AddKeypoolPubkeyWithDB

src/wallet/scriptpubkeyman.cpp:1340–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338}
1339
1340void LegacyScriptPubKeyMan::AddKeypoolPubkeyWithDB(const CPubKey& pubkey, const bool internal, WalletBatch& batch)
1341{
1342 LOCK(cs_KeyStore);
1343 assert(m_max_keypool_index < std::numeric_limits<int64_t>::max()); // How in the hell did you use so many keys?
1344 int64_t index = ++m_max_keypool_index;
1345 if (!batch.WritePool(index, CKeyPool(pubkey, internal))) {
1346 throw std::runtime_error(std::string(__func__) + ": writing imported pubkey failed");
1347 }
1348 if (internal) {
1349 setInternalKeyPool.insert(index);
1350 } else {
1351 setExternalKeyPool.insert(index);
1352 }
1353 m_pool_key_to_index[pubkey.GetID()] = index;
1354}
1355
1356void LegacyScriptPubKeyMan::KeepDestination(int64_t nIndex, const OutputType& type)
1357{

Callers

nothing calls this directly

Calls 4

WritePoolMethod · 0.80
CKeyPoolClass · 0.70
insertMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected