Skip to content

Commit

Permalink
Additional logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xrtm000 committed Jan 16, 2024
1 parent 8fca554 commit 610c7a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 5 additions & 1 deletion node/src/main/scala/com/wavesplatform/mining/Miner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ class MinerImpl(
BlockDiffer
.createInitialBlockSnapshot(blockchainUpdater, reference, miner)
.toOption
.map(initSnapshot => TxStateSnapshotHashBuilder.createHashFromSnapshot(initSnapshot, None).createHash(prevHash))
.map {
initSnapshot =>
log.info(s"initSnapshot $initSnapshot")
TxStateSnapshotHashBuilder.createHashFromSnapshot(initSnapshot, None).createHash(prevHash)
}
}
log.info(s"keyBlockStateHash = $keyBlockStateHash")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,15 @@ object BlockDiffer extends ScorexLogging {
totalRewardPortfolios <- Portfolio.combine(totalMinerPortfolio, nonMinerRewardPortfolios)
patchesSnapshot = leasePatchesSnapshot(blockchainWithNewBlock)
resultSnapshot <- patchesSnapshot.addBalances(totalRewardPortfolios, blockchainWithNewBlock)
} yield resultSnapshot
} yield {
log.info(s"feeFromPreviousBlock = $feeFromPreviousBlock")
log.info(s"initialFeeFromThisBlock = $initialFeeFromThisBlock")
log.info(s"(minerReward, daoPortfolio, xtnBuybackPortfolio) = ${(minerReward, daoPortfolio, xtnBuybackPortfolio)}")
log.info(s"totalRewardPortfolios = $totalRewardPortfolios")
log.info(s"patchesSnapshot = $patchesSnapshot")
log.info(s"lastBlockId = ${blockchainWithNewBlock.lastBlockId}")
resultSnapshot
}

for {
_ <- TracedResult(Either.cond(!verify || block.signatureValid(), (), GenericError(s"Block $block has invalid signature")))
Expand Down Expand Up @@ -308,19 +316,28 @@ object BlockDiffer extends ScorexLogging {
.combine(feeFromPreviousBlock)
.leftMap(GenericError(_))
.flatMap { minerReward =>
log.info(s"rewardShares.miner = ${rewardShares.miner}")
log.info(s"feeFromPreviousBlock = $feeFromPreviousBlock")
log.info(s"minerReward = $minerReward")

val resultPf = Map(miner -> minerReward) ++
daoAddress.map(_ -> Portfolio.waves(rewardShares.daoAddress)) ++
xtnBuybackAddress.map(_ -> Portfolio.waves(rewardShares.xtnBuybackAddress))

log.info(s"resultPf = $resultPf")
log.info(s"lastBlockId = ${blockchain.lastBlockId}")

StateSnapshot.build(blockchain, portfolios = resultPf.filter(!_._2.isEmpty))
}
}

def computeInitialStateHash(blockchain: Blockchain, initSnapshot: StateSnapshot, prevStateHash: ByteStr): ByteStr = {
if (initSnapshot == StateSnapshot.empty || blockchain.height == 1)
prevStateHash
else
else {
log.info(s"initSnapshot $initSnapshot")
TxStateSnapshotHashBuilder.createHashFromSnapshot(initSnapshot, None).createHash(prevStateHash)
}
}

private[this] def apply(
Expand Down

0 comments on commit 610c7a9

Please sign in to comment.