Skip to content

Commit

Permalink
ocd reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight committed Dec 13, 2023
1 parent 539f236 commit 7a4a3cb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ export class ChainAdapter extends UtxoBaseAdapter<KnownChainIds.DogecoinMainnet>
if (!value) throw new Error('value is required')
if (!pubkey) throw new Error('pubkey is required')

const { slow, average, fast } = await this.providers.http.getNetworkFees()
const { fast, average, slow } = await this.providers.http.getNetworkFees()

if (!(fast?.satsPerKiloByte && average?.satsPerKiloByte && slow?.satsPerKiloByte)) {
throw new Error('UtxoBaseAdapter: failed to get fee data')
}

// sane default for invalid fee data from the node
// see: https://github.com/dogecoin/dogecoin/issues/3385
if (slow.satsPerKiloByte <= 0) slow.satsPerKiloByte = 50000000 // .5 DOGE per kB
if (average.satsPerKiloByte <= 0) average.satsPerKiloByte = 100000000 // 1 DOGE per kB
if (fast.satsPerKiloByte <= 0) fast.satsPerKiloByte = 500000000 // 5 DOGE per kB
if (average.satsPerKiloByte <= 0) average.satsPerKiloByte = 100000000 // 1 DOGE per kB
if (slow.satsPerKiloByte <= 0) slow.satsPerKiloByte = 50000000 // .5 DOGE per kB

// ensure higher confirmation speeds never have lower fees than lower confirmation speeds
if (slow.satsPerKiloByte > average.satsPerKiloByte)
Expand Down

0 comments on commit 7a4a3cb

Please sign in to comment.