Skip to content

Commit

Permalink
fix inscribe fee
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Feb 20, 2024
1 parent 6bb326e commit 598779f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/handler/inscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ func Inscribe(ctx *svc.ServiceContext) {
}
}
}
time.Sleep(10 * time.Second)
time.Sleep(3 * time.Second)
}
}
7 changes: 4 additions & 3 deletions pkg/inscribe/inscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func NewInscriptionRequest(btcAPIClient btcapi.Client, address btcutil.Address,
return &InscriptionRequest{
CommitTxOutPointList: commitTxOutPointList,
CommitTxPrivateKeyList: commitTxPrivateKeyList,
CommitFeeRate: recommendedFees.FastestFee + 1,
FeeRate: recommendedFees.FastestFee + 2,
CommitFeeRate: recommendedFees.FastestFee,
FeeRate: recommendedFees.FastestFee,
DataList: dataList,
SingleRevealTxOnly: false,
}, nil
Expand Down Expand Up @@ -330,8 +330,9 @@ func (tool *InscriptionTool) buildCommitTx(commitTxOutPointList []*wire.OutPoint
tx.AddTxOut(tool.txCtxDataList[i].revealTxPrevOutput)
}

witnessSize := len(tx.TxIn)*66 + 2
tx.AddTxOut(wire.NewTxOut(0, *changePkScript))
fee := btcutil.Amount(mempool.GetTxVirtualSize(btcutil.NewTx(tx))) * btcutil.Amount(commitFeeRate)
fee := (btcutil.Amount(mempool.GetTxVirtualSize(btcutil.NewTx(tx))) + btcutil.Amount(witnessSize)) * btcutil.Amount(commitFeeRate)
changeAmount := totalSenderAmount - btcutil.Amount(totalRevealPrevOutput) - fee
if changeAmount > 0 {
tx.TxOut[len(tx.TxOut)-1].Value = int64(changeAmount)
Expand Down
2 changes: 1 addition & 1 deletion test-docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
BITCOIN_NETWORK_NAME: "testnet3"
BITCOIN_PRIVATE_KEY: "55968c09fb90a496096bafdeaac0f791f527b17324d1d0e63d3550e68a7b0cc5"
COMMITTER_DESTINATION_ADDRESS: "tb1ptlp06cp6da4quje623ne8ataf2d4jy80m3jyjqr34c6dp6s5jddqtusute"
image: ghcr.io/b2network/b2-committer:sha-0a6e6ff
image: ghcr.io/b2network/b2-committer:sha-6bb326e
#
#
# node2:
Expand Down

0 comments on commit 598779f

Please sign in to comment.