core, api: go format + docs

This commit is contained in:
Martin Holst Swende 2017-02-07 21:45:19 +01:00
parent 08f541c922
commit f9f81ffedc
2 changed files with 11 additions and 9 deletions

View file

@ -1245,11 +1245,13 @@ func (self *BlockChain) update() {
} }
} }
} }
// SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.
// BadBlockArgs represents the entries in the list returned when bad blocks are queried.
type BadBlockArgs struct { type BadBlockArgs struct {
Hash common.Hash `json:"hash"` Hash common.Hash `json:"hash"`
Header *types.Header `json:"header"` Header *types.Header `json:"header"`
} }
// BadBlocks returns a list of the last 'bad blocks' that the client has seen on the network // BadBlocks returns a list of the last 'bad blocks' that the client has seen on the network
func (bc *BlockChain) BadBlocks() ([]BadBlockArgs, error) { func (bc *BlockChain) BadBlocks() ([]BadBlockArgs, error) {
headers := make([]BadBlockArgs, 0, bc.badBlocks.Len()) headers := make([]BadBlockArgs, 0, bc.badBlocks.Len())
@ -1260,6 +1262,7 @@ func (bc *BlockChain) BadBlocks() ([] BadBlockArgs, error) {
} }
return headers, nil return headers, nil
} }
// Adds a 'bad lock' to the LRU
func (bc *BlockChain) addBadBlock(block *types.Block) { func (bc *BlockChain) addBadBlock(block *types.Block) {
bc.badBlocks.Add(block.Header().Hash(), block.Header()) bc.badBlocks.Add(block.Header().Hash(), block.Header())
} }

View file

@ -567,7 +567,6 @@ func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hex
return db.Get(hash.Bytes()) return db.Get(hash.Bytes())
} }
// GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network // GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network
// and returns them as a JSON list of block-hashes // and returns them as a JSON list of block-hashes
func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]core.BadBlockArgs, error) { func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]core.BadBlockArgs, error) {