WIP: Feature/6/jeffreypicard/dockerize for deployment #7

Closed
jeffreypicard wants to merge 80 commits from feature/6/jeffreypicard/dockerize-for-deployment into master
2 changed files with 32 additions and 4 deletions
Showing only changes of commit 8c3fdc5b61 - Show all commits

View file

@ -137,6 +137,7 @@ var rpcHandlersBeforeInit = map[string]commandHandler{
"decoderawtransaction": handleDecodeRawTransaction,
"decodescript": handleDecodeScript,
"estimatefee": handleEstimateFee,
"estimatesmartfee": handleEstimateSmartFee,
"generate": handleGenerate,
"generatetoaddress": handleGenerateToAddress,
"getaddednodeinfo": handleGetAddedNodeInfo,
@ -879,23 +880,40 @@ func handleEstimateFee(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
c := cmd.(*btcjson.EstimateFeeCmd)
if s.cfg.FeeEstimator == nil {
return nil, errors.New("Fee estimation disabled")
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInternal.Code,
Message: "Fee estimation disabled",
}
}
if c.NumBlocks <= 0 {
return -1.0, errors.New("Parameter NumBlocks must be positive")
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: "Parameter NumBlocks must be positive",
}
}
feeRate, err := s.cfg.FeeEstimator.EstimateFee(uint32(c.NumBlocks))
if err != nil {
return -1.0, err
return nil, &btcjson.RPCError{
Code: btcjson.ErrRPCInvalidParameter,
Message: err.Error(),
}
}
// Convert to satoshis per kb.
return float64(feeRate), nil
}
func handleEstimateSmartFee(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.EstimateSmartFeeCmd)
rpcsLog.Debugf("EstimateSmartFee is not implemented; falling back to EstimateFee. Requested mode: %s", c.EstimateMode)
return handleEstimateFee(s, &btcjson.EstimateFeeCmd{NumBlocks: c.ConfTarget}, closeChan)
}
func handleGenerate(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
// Respond with an error if there are no addresses to pay the
// created blocks to.

View file

@ -123,9 +123,18 @@ var helpDescsEnUS = map[string]string{
"blocks have been generated.",
"estimatefee-numblocks": "The maximum number of blocks which can be " +
"generated before the transaction is mined.",
"estimatefee--result0": "Estimated fee per kilobyte in satoshis for a block to " +
"estimatefee--result0": "Estimated fee per kilobyte in satoshis necessary for a block to " +
"be mined in the next NumBlocks blocks.",
"estimatesmartfee--synopsis": "Estimate the fee per kilobyte in satoshis " +
"required for a transaction to be mined before a certain number of " +
"blocks have been generated. Same as estimatefee presently.",
"estimatesmartfee-conftarget": "The maximum number of blocks which can be " +
"generated before the transaction is mined.",
"estimatesmartfee-estimatemode": "Unused at present.",
"estimatesmartfee--result0": "Estimated fee per kilobyte in satoshis necessary for a block to " +
"be mined in the next ConfTarget blocks.",
// GenerateCmd help
"generate--synopsis": "Generates a set number of blocks (simnet or regtest only) and returns a JSON\n" +
" array of their hashes.",
@ -841,6 +850,7 @@ var rpcResultTypes = map[string][]interface{}{
"decoderawtransaction": {(*btcjson.TxRawDecodeResult)(nil)},
"decodescript": {(*btcjson.DecodeScriptResult)(nil)},
"estimatefee": {(*float64)(nil)},
"estimatesmartfee": {(*float64)(nil)},
"generate": {(*[]string)(nil)},
"generatetoaddress": {(*[]string)(nil)},
"getaddednodeinfo": {(*[]string)(nil), (*[]btcjson.GetAddedNodeInfoResult)(nil)},