-
Notifications
You must be signed in to change notification settings - Fork 30
Dynamic fees #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Dynamic fees #80
Conversation
if (fJustCheck) | ||
return true; | ||
|
||
//TODO: LOG ERRORS OR TERMINATE METHOD AND RETURN ERROR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably also want this code only to be activated if the height is above the voting height.
src/main.cpp
Outdated
vector <CTransaction> vOrderedProposalTransactions; | ||
proposalManager.GetDeterministicOrdering(pindexPrev->hashProofOfStake, vProposalTransactions, | ||
vOrderedProposalTransactions); | ||
for (CTransaction txProposal: vOrderedProposalTransactions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this shouldn't be const ref?
src/main.cpp
Outdated
} | ||
|
||
vector <CTransaction> vOrderedProposalTransactions; | ||
proposalManager.GetDeterministicOrdering(pindexPrev->hashProofOfStake, vProposalTransactions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this method returns a bool
, lets handle the case that it returns false.
src/main.cpp
Outdated
// If the maximum fee provided by the proposal creator is less than the required fee | ||
// then create an unaccepted proposal refund | ||
if (nRequiredFee > proposal.GetMaxFee()) { | ||
proposalManager.AddRefundToCoinBase(proposal, nRequiredFee, nTxFee, false, txCoinBase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets handle the case that this method returns false
.
Also we could simplify the scoping doing something like:
bool fProposalAccepted = nRequiredFee > proposal.GetMaxFee();
proposalManager.AddRefundToCoinBase(proposal, nRequiredFee, nTxFee, fProposalAccepted, txCoinBase);
CScript scriptProposal = tx.vout[0].scriptPubKey; | ||
vchProposal.insert(vchProposal.end(), scriptProposal.begin() + 6, scriptProposal.end()); | ||
|
||
vchProposal.insert(vchProposal.end(), scriptProposal.begin() + (scriptProposal.size() > 0x04c ? 7 : 6), scriptProposal.end()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the magic numbers with typedefs
or #define
macro.
bool CVoteProposalManager::GetAcceptedTxProposals(const CTransaction& txCoinBase, const std::vector<CTransaction>& vOrderedTxProposals, | ||
std::vector<CTransaction>& vAcceptedTxProposals) | ||
{ | ||
if (!txCoinBase.IsCoinBase()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to add more logic to IsCoinBase()
so that these transactions are still seen as coinbase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What additional logic is needed?
IsCoinBase() just checks -> (vin.size() == 1 && vin[0].prevout.IsNull() && vout.size() >= 1);
By this logic I think refund transactions will still be seen as coinbase transactions.
…tic ordering algo complete
… rules to connectblock
The code is passing the basic tests I created so I think it's ready for review. I tried cleaning up a little but there's still some refactoring I plan on doing. Also, I'm not positive that all the necessary height checks for the hard fork were put in. Besides that, all that's left to do is tweak the fee heuristic.