Proper payout ordering on json block

This commit is contained in:
DataHoarder 2022-10-08 22:44:41 +02:00
parent 4f1c4acbe5
commit f11a92887f
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -25,13 +25,13 @@ func MapJSONBlock(api *api.Api, block database.BlockInterface, extraUncleData, e
}
if b.Main.Found && tx != nil {
b.Coinbase.Payouts = make([]*database.JSONCoinbaseOutput, 0, len(tx.Outputs()))
b.Coinbase.Payouts = make([]*database.JSONCoinbaseOutput, len(tx.Outputs()))
for _, output := range tx.Outputs() {
b.Coinbase.Payouts = append(b.Coinbase.Payouts, &database.JSONCoinbaseOutput{
b.Coinbase.Payouts[output.Index()] = &database.JSONCoinbaseOutput{
Amount: output.Amount(),
Index: output.Index(),
Address: api.GetDatabase().GetMiner(output.Miner()).Address(),
})
}
}
} else {
payoutHint := api.GetBlockWindowPayouts(b)