Problem: run_upsert_validator_approve casts votes for *all* voters, not just the user calling the command

Solution: Filter vote txs by the users public key
This commit is contained in:
z-bowen 2018-08-23 14:06:56 +02:00
parent 7b1c55fc50
commit 8c0bf8caa0

View File

@ -161,7 +161,8 @@ def run_upsert_validator_approve(args, bigchain):
tx = bigchain.get_transaction(args.election_id) tx = bigchain.get_transaction(args.election_id)
voting_power = [v.amount for v in tx.outputs if key.public_key in v.public_keys][0] voting_power = [v.amount for v in tx.outputs if key.public_key in v.public_keys][0]
approval = ValidatorElectionVote.generate(tx.to_inputs(), [ inputs = [input for input in tx.to_inputs() if key.public_key in input.owners_before]
approval = ValidatorElectionVote.generate(inputs, [
([key.public_key], voting_power)], tx.id).sign([key.private_key]) ([key.public_key], voting_power)], tx.id).sign([key.private_key])
approval.validate(bigchain) approval.validate(bigchain)