lbryio / lbrycrd

The blockchain that provides the digital content namespace for the LBRY protocol
https://lbry.com
MIT License
2.57k stars 178 forks source link

Add fees to claim trie transactions #95

Closed kaykurokawa closed 6 years ago

kaykurokawa commented 6 years ago

7f2f918 / reworked to: 1f137fc Add new function CalcMinClaimTrieFee to calculate the minimum fee required for claim trie transactions. Works based on MIN_FEE_PER_NAMECLAIM_CHAR , which defines the fee attached per each character of the name in the name claim. Set to 200000 base units or (0.002 LBC) for max fee 0.51 LBC (0.002*255 max length name claim).

Added test for it in nameclaim_tests.cpp (that we should expand with other tests for nameclaim.cpp)

8384c04 / reworked to: 12784d4 increase DEFAULT_TRANSACTION_MAXFEE from 0.1 to 1 since we can now get fees over 0.1 LBC

7f2f918 / reworked to: 5c4d8b9 implement CalcMinClaimTrieFee into AcceptToMemoryPool to allow CalcMinClaimTrieFee to take effect when rejecting transactions from the memory pool. Implement CalcMinClaimTrieFee into src/wallet/wallet.cpp so that generated transactions take into consideration the claim trie fee.

Not sure this is the best way to do it though, ideally the function signature for AcceptToMemoryPool is not affected, but we still need a way to turn off the cacluation of minimum claim trie fee for the tests in claimtrie_tests.cpp and claimtriebranching_tests.cpp, otherwise they break. Will rethink this commit.

EDIT2: This has been reworked : CalcMinClaimTrieFee now takes as argument minFeePerNameClaimChar . This variable is set as a global in main.cpp along with other globals. This allows it to be set freely to whatever is needed for testing purposes.

tzarebczan commented 6 years ago

@kaykurokawa what's the next step here?

kaykurokawa commented 6 years ago

Made small change that lbrynaut suggested, rebased and merging.