Skip to content

Commit

Permalink
rpc: set miner fee
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Oct 3, 2024
1 parent aad5fd7 commit 1406d3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rhp/v4/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type (
// includes the parents and the transaction itself in an order valid
// for broadcasting.
V2TransactionSet(basis types.ChainIndex, txn types.V2Transaction) (types.ChainIndex, []types.V2Transaction, error)
// RecommendedFee returns the recommended fee per byte for a transaction.
RecommendedFee() types.Currency
}

// A ContractSigner is a minimal interface for contract signing.
Expand Down Expand Up @@ -511,7 +513,7 @@ func RPCAccountBalance(ctx context.Context, t TransportClient, account rhp4.Acco
func RPCFormContract(ctx context.Context, t TransportClient, tp TxPool, signer FormContractSigner, cs consensus.State, p rhp4.HostPrices, hostKey types.PublicKey, hostAddress types.Address, params rhp4.RPCFormContractParams) (RPCFormContractResult, error) {
fc := rhp4.NewContract(p, params, hostKey, hostAddress)
formationTxn := types.V2Transaction{
MinerFee: types.Siacoins(1), // TODO: be better
MinerFee: tp.RecommendedFee().Mul64(1000),
FileContracts: []types.V2FileContract{fc},
}

Expand Down Expand Up @@ -630,7 +632,7 @@ func RPCFormContract(ctx context.Context, t TransportClient, tp TxPool, signer F
func RPCRenewContract(ctx context.Context, t TransportClient, tp TxPool, signer FormContractSigner, cs consensus.State, p rhp4.HostPrices, existing types.V2FileContract, params rhp4.RPCRenewContractParams) (RPCRenewContractResult, error) {
renewal := rhp4.NewRenewal(existing, p, params)
renewalTxn := types.V2Transaction{
MinerFee: types.Siacoins(1), // TODO: something about this
MinerFee: tp.RecommendedFee().Mul64(1000),
FileContractResolutions: []types.V2FileContractResolution{
{
Parent: types.V2FileContractElement{
Expand Down

0 comments on commit 1406d3d

Please sign in to comment.