accounts, cmd: port packages over to the new logging system

This commit is contained in:
Péter Szilágyi
2017-02-22 16:58:00 +02:00
parent 61e6bb1247
commit 23a5d64fd0
10 changed files with 74 additions and 70 deletions

View File

@ -29,18 +29,19 @@ import (
// WaitMined waits for tx to be mined on the blockchain.
// It stops waiting when the context is canceled.
func WaitMined(ctx context.Context, b DeployBackend, tx *types.Transaction) (*types.Receipt, error) {
queryTicker := time.NewTicker(1 * time.Second)
queryTicker := time.NewTicker(time.Second)
defer queryTicker.Stop()
loghash := tx.Hash().Hex()[:8]
logger := log.New("hash", tx.Hash().Hex()[:8])
for {
receipt, err := b.TransactionReceipt(ctx, tx.Hash())
if receipt != nil {
return receipt, nil
}
if err != nil {
log.Trace(fmt.Sprintf("tx %x error: %v", loghash, err))
logger.Trace("Receipt retrieval failed", "error", err)
} else {
log.Trace(fmt.Sprintf("tx %x not yet mined...", loghash))
logger.Trace("Transaction not yet mined")
}
// Wait for the next round.
select {