Add comments
This commit is contained in:
parent
3cb20f26a1
commit
c233f6fd31
14
src/init.cpp
14
src/init.cpp
|
@ -1747,6 +1747,20 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
// This is leveraging the fact that boost::signals2 executes connected
|
||||
// handlers in-order. Further up, the wallet is connected to this signal
|
||||
// if the wallet is enabled. The wallet's ScriptForMining handler does
|
||||
// nothing if -mineraddress is set, and GetScriptForMinerAddress() does
|
||||
// nothing if -mineraddress is not set (or set to an invalid address).
|
||||
//
|
||||
// The upshot is that when ScriptForMining(script) is called:
|
||||
// - If -mineraddress is set (whether or not the wallet is enabled), the
|
||||
// CScript argument is set to -mineraddress.
|
||||
// - If the wallet is enabled and -mineraddress is not set, the CScript
|
||||
// argument is set to a wallet address.
|
||||
// - If the wallet is disabled and -mineraddress is not set, the CScript
|
||||
// argument is not modified; in practice this means it is empty, and
|
||||
// GenerateBitcoins() returns an error.
|
||||
GetMainSignals().ScriptForMining.connect(GetScriptForMinerAddress);
|
||||
}
|
||||
#endif // ENABLE_MINING
|
||||
|
|
|
@ -407,6 +407,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||
|
||||
class MinerAddressScript : public CReserveScript
|
||||
{
|
||||
// CReserveScript requires implementing this function, so that if an
|
||||
// internal (not-visible) wallet address is used, the wallet can mark it as
|
||||
// important when a block is mined (so it then appears to the user).
|
||||
// If -mineraddress is set, the user already knows about and is managing the
|
||||
// address, so we don't need to do anything here.
|
||||
void KeepScript() {}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue