Fix issue causing invalid vote reveal tx

- Set PHASE_VOTE_REVEAL duration to 2 blocks as 1 block would cause an
invalid state (confirmation block is one block after phase)
- Rename getStateBuilder to getBsqStateBuilder
This commit is contained in:
Manfred Karrer 2018-09-24 18:30:05 -05:00
parent ff4e22d5f5
commit ee1317c64a
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
3 changed files with 18 additions and 18 deletions

View file

@ -264,10 +264,10 @@ public class TxParser {
/**
* Whether the BSQ fee and phase is valid for a transaction.
*
* @param blockHeight The height of the block that the transaction is in.
* @param bsqFee The fee in BSQ, in satoshi.
* @param phase The current phase of the DAO, e.g {@code DaoPhase.Phase.PROPOSAL}.
* @param param The parameter for the fee, e.g {@code Param.PROPOSAL_FEE}.
* @param blockHeight The height of the block that the transaction is in.
* @param bsqFee The fee in BSQ, in satoshi.
* @param phase The current phase of the DAO, e.g {@code DaoPhase.Phase.PROPOSAL}.
* @param param The parameter for the fee, e.g {@code Param.PROPOSAL_FEE}.
* @return True if the fee and phase was valid, false otherwise.
*/
private boolean isFeeAndPhaseValid(int blockHeight, long bsqFee, DaoPhase.Phase phase, Param param) {
@ -296,10 +296,10 @@ public class TxParser {
/**
* Retrieve the type of the transaction, assuming it is relevant to bisq.
*
* @param tx The temporary transaction.
* @param hasOpReturnCandidate True if we have a candidate for an OP_RETURN.
* @param remainingInputValue The remaining value of inputs not yet accounted for, in satoshi.
* @param optionalOpReturnType If present, the OP_RETURN type of the transaction.
* @param tx The temporary transaction.
* @param hasOpReturnCandidate True if we have a candidate for an OP_RETURN.
* @param remainingInputValue The remaining value of inputs not yet accounted for, in satoshi.
* @param optionalOpReturnType If present, the OP_RETURN type of the transaction.
* @return The type of the transaction, if it is relevant to bisq.
*/
@VisibleForTesting
@ -399,10 +399,10 @@ public class TxParser {
/**
* Parse and return the genesis transaction for bisq, if applicable.
*
* @param genesisTxId The transaction id of the bisq genesis transaction.
* @param genesisBlockHeight The block height of the bisq genesis transaction.
* @param genesisTotalSupply The total supply of the genesis issuance for bisq.
* @param rawTx The candidate transaction.
* @param genesisTxId The transaction id of the bisq genesis transaction.
* @param genesisBlockHeight The block height of the bisq genesis transaction.
* @param genesisTotalSupply The total supply of the genesis issuance for bisq.
* @param rawTx The candidate transaction.
* @return The genesis transaction if applicable, or Optional.empty() otherwise.
*/
public static Optional<TempTx> findGenesisTx(String genesisTxId, int genesisBlockHeight, Coin genesisTotalSupply,

View file

@ -132,10 +132,10 @@ public class BsqState implements PersistableEnvelope {
@Override
public Message toProtoMessage() {
return PB.PersistableEnvelope.newBuilder().setBsqState(getStateBuilder()).build();
return PB.PersistableEnvelope.newBuilder().setBsqState(getBsqStateBuilder()).build();
}
private PB.BsqState.Builder getStateBuilder() {
private PB.BsqState.Builder getBsqStateBuilder() {
final PB.BsqState.Builder builder = PB.BsqState.newBuilder();
builder.setChainHeight(chainHeight)
.addAllBlocks(blocks.stream().map(Block::toProtoMessage).collect(Collectors.toList()))
@ -193,10 +193,10 @@ public class BsqState implements PersistableEnvelope {
}
BsqState getClone() {
return (BsqState) BsqState.fromProto(getStateBuilder().build());
return (BsqState) BsqState.fromProto(getBsqStateBuilder().build());
}
BsqState getClone(BsqState snapshotCandidate) {
return (BsqState) BsqState.fromProto(snapshotCandidate.getStateBuilder().build());
return (BsqState) BsqState.fromProto(snapshotCandidate.getBsqStateBuilder().build());
}
}

View file

@ -74,9 +74,9 @@ public enum Param {
PHASE_BREAK1(1), // 10 blocks
PHASE_BLIND_VOTE(2), // 4 days
PHASE_BREAK2(1), // 10 blocks
PHASE_VOTE_REVEAL(1), // 2 days
PHASE_VOTE_REVEAL(2), // 2 days
PHASE_BREAK3(1), // 10 blocks
PHASE_RESULT(1), // 1 block
PHASE_RESULT(2), // 1 block
PHASE_BREAK4(1); // 10 blocks
/*PHASE_UNDEFINED(0),