onchain 2.1.10 → 2.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onchain/transaction.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102764b35c45434b7de5d8233e4324cf0fdc20e6
|
4
|
+
data.tar.gz: 2e5ba665c72b696fba978c71cc98a44ec3ccc248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4daf8b78f1ff73c54ee17d3641e8145c5b077220a4856ac3162072e18a07e2443ec06a4d8a07e87b53d9e8f1666fb917ecff8109b89ff474b2469b2dc143c54e
|
7
|
+
data.tar.gz: 222d3a2738469de118a205bc15d7b9da5176fd78b3ab208ab0513640c587438cc7d5a0971aad38e913cf5350c69c1e0f4961ddbc2fa48997d04c0b3db9018f25
|
data/lib/onchain/transaction.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
class OnChain::Transaction
|
2
2
|
class << self
|
3
3
|
|
4
|
-
def create_single_address_transaction(orig_addr, dest_addr, amount, fee_percent, fee_addr)
|
4
|
+
def create_single_address_transaction(orig_addr, dest_addr, amount, fee_percent, fee_addr, min_fee_satoshi)
|
5
5
|
|
6
6
|
tx = Bitcoin::Protocol::Tx.new
|
7
7
|
|
8
|
-
fee = calculate_fee(amount, fee_percent)
|
8
|
+
fee = calculate_fee(amount, fee_percent, min_fee_satoshi)
|
9
9
|
|
10
10
|
total_amount = amount + fee
|
11
11
|
|
@@ -112,12 +112,12 @@ class OnChain::Transaction
|
|
112
112
|
return OnChain::bin_to_hex(tx.to_payload), inputs_to_sign
|
113
113
|
end
|
114
114
|
|
115
|
-
def calculate_fee(amount, fee_percent)
|
115
|
+
def calculate_fee(amount, fee_percent, min_fee_satoshi)
|
116
116
|
|
117
117
|
fee = (amount * (fee_percent / 100.0)).to_i
|
118
118
|
|
119
|
-
if fee <
|
120
|
-
return
|
119
|
+
if fee < min_fee_satoshi
|
120
|
+
return min_fee_satoshi
|
121
121
|
end
|
122
122
|
|
123
123
|
return fee
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onchain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Purton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|