From 4d4596a6418fc0a8c76032e6f4ffea17a1f23a0b Mon Sep 17 00:00:00 2001 From: lzx <393768033@qq.com> Date: Wed, 16 Apr 2025 17:24:06 +0800 Subject: [PATCH] update --- internal/gbt/alph/alph.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/gbt/alph/alph.go b/internal/gbt/alph/alph.go index 322e064..5267bc7 100644 --- a/internal/gbt/alph/alph.go +++ b/internal/gbt/alph/alph.go @@ -217,17 +217,17 @@ func update_block_confirm(gbt *GbtAlphContext) { blockInfo := gbt.GbtCtx.ClientAlphApi.GetBlcokInfo(blockHash) var total_amount float64 = 0 fromGroup, toGroup, nonce, height := blockInfo.ChainFrom, blockInfo.ChainTo, blockInfo.Nonce, blockInfo.Height - for _, tx := range blockInfo.Transactions { - for _, out := range tx.Unsigned.FixedOutputs { - if out.Address == addr[fromGroup] && nonce == blockInfo.Nonce { - amount := out.AttoAlphAmount - total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18)) - fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, " ", blockHash, " ", out.Address, " 报块成功") - } else { - fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, "不是报块,实际报块地址为:", out.Address) - } + // for _, tx := range blockInfo.Transactions { + for _, out := range blockInfo.Transactions[len(blockInfo.Transactions)-1].Unsigned.FixedOutputs { + if out.Address == addr[fromGroup] && nonce == blockInfo.Nonce { + amount := out.AttoAlphAmount + total_amount += savePoint4(stringToFloat64(amount) / math.Pow(10, 18)) + fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, " ", blockHash, " ", out.Address, " 报块成功") + } else { + fmt.Println(fromGroup, "->", toGroup, "(", height, "):", total_amount, ",", nonce, "不是报块,实际报块地址为:", out.Address) } } + // } block_height := height // 用区块链返回的height,防止某个块成为下一个高度的叔块,导致高度变化 dbif.AlphNotifyPoolBlkStatsSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx), total_amount, 0) dbif.NotifyAlphBlkDetailSuccess(gbt.GbtCtx, uint32(fromGroup), uint32(toGroup), block_height, "", block.Nonce, int64(block.SubIdx))