mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* [NOD-1416] Add entry/exit logs to all the functions. * [NOD-1416] Build some scaffolding inside BlockProcessor. * [NOD-1416] Implement selectParentsForNewBlock. * [NOD-1416] Implement validateBlock. * [NOD-1476] Fix merge errors. * [NOD-1416] Move buildBlock and validateAndInsertBlock to separate files. * [NOD-1416] Begin implementing buildBlock. * [NOD-1416] Implement newBlockDifficulty. * [NOD-1416] Add skeletons for the rest of the buildBlock functions. * [NOD-1416] Implement newBlockUTXOCommitment. * [NOD-1416] Implement newBlockAcceptedIDMerkleRoot. * [NOD-1416] Implement newBlockHashMerkleRoot. * [NOD-1416] Fix bad function call. * [NOD-1416] Implement validateHeaderAndProofOfWork and validateBody. * [NOD-1416] Use ValidateProofOfWorkAndDifficulty. * [NOD-1416] Finish validateAndInsertBlock. * [NOD-1416] Implement newBlockHashMerkleRoot. * [NOD-1416] Implement newBlockAcceptedIDMerkleRoot. * [NOD-1416] Fix a comment. * [NOD-1416] Implement newBlockCoinbaseTransaction. * [NOD-1416] Add VirtualBlockHash. * [NOD-1416] Add ParentHashes and SelectedParent to VirtualData(). * [NOD-1416] Make go vet happy. * [NOD-1416] Implement discardAllChanges. * [NOD-1416] Implement commitAllChanges. * [NOD-1416] Fix factory. * [NOD-1416] Make go vet happy. * [NOD-1416] Format factory. * [NOD-1416] Pass transactionsWithCoinbase to buildHeader. * [NOD-1416] Call VirtualData() from buildHeader. * [NOD-1416] Fix a typo. * [NOD-1416] Fix in-out-of-context/header-body confusion. * [NOD-1416] Extract LogAndMeasureExecutionTime. * [NOD-1416] Add a comment about LogAndMeasureExecutionTime. * [NOD-1416] Simplify discardAllChanges and commitAllChanges. * [NOD-1416] If in-context validations fail, discard all changes and store the block with StatusInvalid. * [NOD-1416] Add a comment above Store. * [NOD-1416] Use errors.As instead of errors.Is.
18 lines
482 B
Go
18 lines
482 B
Go
package logger
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// LogAndMeasureExecutionTime logs that `functionName` has
|
|
// started. The user is expected to defer `onEnd`, which
|
|
// will then log that the function has ended, as well as
|
|
// the time duration the function had ran.
|
|
func LogAndMeasureExecutionTime(log *Logger, functionName string) (onEnd func()) {
|
|
start := time.Now()
|
|
log.Debugf("%s start", functionName)
|
|
return func() {
|
|
log.Debugf("%s end. Took: %s", functionName, time.Since(start))
|
|
}
|
|
}
|