0

https://github.com/bitcoin/bitcoin/blob/aaaaad6ac95b402fe18d019d67897ced6b316ee0/src/consensus/tx_check.cpp#L27

If txout.nValue is more than the circulating supply and less than MAX_MONEY, CheckTransaction would return true.

Why not check txout.nValue against the circulating supply? and if it is above then just return false at that point.

2 Answers 2

2

There is no point. It would just be slower and more complex for no gain.

Despite what the name may imply, that test is not there to enforce the inflation schedule. It's there to prevent exploiting integer overflow (something which happened in Bitcoin's early history).

The test could be replaced with > 1000000000000000000 instead and be equally effective.

1
  • Just to elaborate a tiny bit: Five lines above the line linked in the question there is a comment saying // Check for negative or overflow output values (see CVE-2010-5139). Looking up that CVE (any search engine) yields the explanation regarding integer overflow. The only reason I looked is because when I read Pieter's answer my immediate thought was - "that's the sort of thing I'd put in a comment against that line of code" - so I looked to see if someone had done that or not. Commented May 17, 2020 at 9:35
0

Added explanation: There is also no direct way of calculating "circulating supply". Circulation is not something the protocol can identify. By circulating supply we simply mean

TotalSupply - ((coins estimated to be lost) + (satoshi's coins)).

Trying to enforce against circulating supply in the protocol will be unnecessarily heuristical and will provide no functional benefit.

To verify no new money is created, its enough to just check against max money.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.