mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-06 04:54:20 +01:00
bumpfee first draft
This commit is contained in:
@@ -32,6 +32,7 @@ action_getbalancebyxpub=spender
|
||||
action_getbalancebyxpublabel=spender
|
||||
action_getnewaddress=spender
|
||||
action_spend=spender
|
||||
action_bumpfee=spender
|
||||
action_addtobatch=spender
|
||||
action_batchspend=spender
|
||||
action_deriveindex=spender
|
||||
|
||||
@@ -56,3 +56,6 @@ blocknotify=/usr/bin/curl proxy:8888/newblock/%s
|
||||
<% if ( bitcoin_uacomment != null && bitcoin_uacomment != '' ) { %>
|
||||
uacomment=<%= bitcoin_uacomment %>
|
||||
<% } %>
|
||||
|
||||
addresstype=bech32
|
||||
walletrbf=1
|
||||
|
||||
@@ -35,6 +35,7 @@ action_getbalancebyxpub=spender
|
||||
action_getbalancebyxpublabel=spender
|
||||
action_getnewaddress=spender
|
||||
action_spend=spender
|
||||
action_bumpfee=spender
|
||||
action_addtobatch=spender
|
||||
action_batchspend=spender
|
||||
action_deriveindex=spender
|
||||
|
||||
@@ -294,7 +294,7 @@ When cyphernode receives a transaction confirmation (/conf endpoint) on a watche
|
||||
|
||||
### Get mempool information
|
||||
|
||||
Returns the mempool information of the Bitcoin node.
|
||||
Returns the mempool information of the Bitcoin node.
|
||||
```http
|
||||
GET http://cyphernode:8888/getmempoolinfo
|
||||
```
|
||||
@@ -618,6 +618,27 @@ Proxy response:
|
||||
}
|
||||
```
|
||||
|
||||
### Bump transaction's fees (called by application)
|
||||
|
||||
Calls bumpfee RPC on the spending wallet with supplied info.
|
||||
|
||||
```http
|
||||
POST http://cyphernode:8888/bumpfee
|
||||
with body...
|
||||
{"txid":"af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648","confTarget":4}
|
||||
```
|
||||
|
||||
Proxy response:
|
||||
|
||||
```json
|
||||
{
|
||||
"txid": "af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648",
|
||||
"origfee": 0.00041221,
|
||||
"fee": 0.00068112,
|
||||
"errors": [ "Blabla don't do that" ]
|
||||
}
|
||||
```
|
||||
|
||||
### Add an output to the next batched transaction (called by application)
|
||||
|
||||
Inserts output information in the DB. Used when batchspend is called later.
|
||||
|
||||
@@ -782,6 +782,62 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
/bumpfee:
|
||||
post:
|
||||
tags:
|
||||
- "spending wallet"
|
||||
- "core features"
|
||||
summary: "Bump the fees of an unconfirmed transaction"
|
||||
description: "Calls bumpfee RPC on the spending wallet with supplied info."
|
||||
operationId: "bumpfee"
|
||||
requestBody:
|
||||
description: "txid and confirmation target"
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
required:
|
||||
- "txid"
|
||||
- "confTarget"
|
||||
properties:
|
||||
txid:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
confTarget:
|
||||
type: "number"
|
||||
responses:
|
||||
'200':
|
||||
description: "operation successful"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: "object"
|
||||
required:
|
||||
- "txid"
|
||||
- "origfee"
|
||||
- "fee"
|
||||
- "errors"
|
||||
properties:
|
||||
txid:
|
||||
$ref: '#/components/schemas/TypeHashString'
|
||||
origfee:
|
||||
type: "number"
|
||||
fee:
|
||||
type: "number"
|
||||
errors:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
'403':
|
||||
$ref: '#/components/schemas/ApiResponseNotAllowed'
|
||||
'405':
|
||||
$ref: '#/components/schemas/ApiResponseInvalidInput'
|
||||
'503':
|
||||
description: "Resource temporarily unavailable"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
|
||||
/addtobatch:
|
||||
post:
|
||||
tags:
|
||||
|
||||
@@ -256,6 +256,14 @@ main()
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
bumpfee)
|
||||
# POST http://192.168.111.152:8080/bumpfee
|
||||
# BODY {"txid":"af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648","confTarget":4}
|
||||
|
||||
response=$(bumpfee "${line}")
|
||||
response_to_client "${response}" ${?}
|
||||
break
|
||||
;;
|
||||
addtobatch)
|
||||
# POST http://192.168.111.152:8080/addtobatch
|
||||
# BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233}
|
||||
|
||||
@@ -62,6 +62,32 @@ spend() {
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
bumpfee() {
|
||||
trace "Entering bumpfee()..."
|
||||
|
||||
local request=${1}
|
||||
local txid=$(echo "${request}" | jq ".txid" | tr -d '"')
|
||||
trace "[bumpfee] txid=${txid}"
|
||||
local confTarget=$(echo "${request}" | jq ".confTarget")
|
||||
trace "[bumpfee] confTarget=${confTarget}"
|
||||
local response
|
||||
|
||||
response=$(send_to_spender_node "{\"method\":\"bumpfee\",\"params\":[\"${txid}\",{\"confTarget\":${confTarget}}]}")
|
||||
local returncode=$?
|
||||
trace_rc ${returncode}
|
||||
trace "[bumpfee] response=${response}"
|
||||
|
||||
if [ "${returncode}" -eq 0 ]; then
|
||||
trace "[bumpfee] error!"
|
||||
else
|
||||
trace "[bumpfee] success!"
|
||||
fi
|
||||
|
||||
echo "${response}"
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
getbalance() {
|
||||
trace "Entering getbalance()..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user