2017-11-02 19:37:07 +00:00
|
|
|
package observers
|
2017-10-23 15:56:29 +00:00
|
|
|
|
2017-10-25 22:24:38 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
2017-11-02 19:37:07 +00:00
|
|
|
|
2017-11-06 18:53:43 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/core"
|
2017-10-25 22:24:38 +00:00
|
|
|
)
|
2017-10-23 15:56:29 +00:00
|
|
|
|
|
|
|
type BlockchainLoggingObserver struct{}
|
|
|
|
|
2017-11-02 19:37:07 +00:00
|
|
|
func (blockchainObserver BlockchainLoggingObserver) NotifyBlockAdded(block core.Block) {
|
2017-10-25 22:24:38 +00:00
|
|
|
fmt.Printf("New block was added: %d\n"+
|
|
|
|
"\tTime: %v\n"+
|
|
|
|
"\tGas Limit: %d\n"+
|
|
|
|
"\tGas Used: %d\n"+
|
2017-10-31 17:51:05 +00:00
|
|
|
"\tNumber of Transactions %d\n", block.Number, time.Unix(block.Time, 0), block.GasLimit, block.GasUsed, len(block.Transactions))
|
2017-10-23 15:56:29 +00:00
|
|
|
}
|