From 8c0bf8caa0ae43a22bdfadedfa23203f5f046b9c Mon Sep 17 00:00:00 2001 From: z-bowen Date: Thu, 23 Aug 2018 14:06:56 +0200 Subject: [PATCH] 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 --- bigchaindb/commands/bigchaindb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bigchaindb/commands/bigchaindb.py b/bigchaindb/commands/bigchaindb.py index f26a628b..1712b7e9 100644 --- a/bigchaindb/commands/bigchaindb.py +++ b/bigchaindb/commands/bigchaindb.py @@ -161,7 +161,8 @@ def run_upsert_validator_approve(args, bigchain): 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] - 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]) approval.validate(bigchain)