@@ -1060,10 +1060,10 @@ func (bc *Blockchain) CreateRegisterAsValidatorTxn(
10601060 )
10611061 }
10621062
1063- // Sanity-check that the spendAmount is zero .
1064- if spendAmount != 0 {
1063+ // Sanity-check that the spendAmount equals the sum of the additional outputs .
1064+ if err = amountEqualsAdditionalOutputs ( spendAmount , additionalOutputs ); err != nil {
10651065 return nil , 0 , 0 , 0 , fmt .Errorf (
1066- "Blockchain.CreateRegisterAsValidatorTxn: spend amount is non-zero: %d " , spendAmount ,
1066+ "Blockchain.CreateRegisterAsValidatorTxn: %v " , err ,
10671067 )
10681068 }
10691069 return txn , totalInput , changeAmount , fees , nil
@@ -1132,10 +1132,10 @@ func (bc *Blockchain) CreateUnregisterAsValidatorTxn(
11321132 )
11331133 }
11341134
1135- // Sanity-check that the spendAmount is zero .
1136- if spendAmount != 0 {
1135+ // Sanity-check that the spendAmount equals the sum of the additional outputs .
1136+ if err = amountEqualsAdditionalOutputs ( spendAmount , additionalOutputs ); err != nil {
11371137 return nil , 0 , 0 , 0 , fmt .Errorf (
1138- "Blockchain.CreateUnregisterAsValidatorTxn: spend amount is non-zero: %d " , spendAmount ,
1138+ "Blockchain.CreateUnregisterAsValidatorTxn: %v " , err ,
11391139 )
11401140 }
11411141 return txn , totalInput , changeAmount , fees , nil
@@ -1204,10 +1204,10 @@ func (bc *Blockchain) CreateUnjailValidatorTxn(
12041204 )
12051205 }
12061206
1207- // Sanity-check that the spendAmount is zero .
1208- if spendAmount != 0 {
1207+ // Sanity-check that the spendAmount equals the sum of the additional outputs .
1208+ if err = amountEqualsAdditionalOutputs ( spendAmount , additionalOutputs ); err != nil {
12091209 return nil , 0 , 0 , 0 , fmt .Errorf (
1210- "Blockchain.CreateUnjailValidatorTxn: spend amount is non-zero: %d " , spendAmount ,
1210+ "Blockchain.CreateUnjailValidatorTxn: %v " , err ,
12111211 )
12121212 }
12131213 return txn , totalInput , changeAmount , fees , nil
0 commit comments