FIX: Wont broadcast tx with too small fee

This commit is contained in:
Overtorment 2018-08-18 16:49:36 +01:00
parent d07082f4dd
commit 46fb9617e0
2 changed files with 13 additions and 2 deletions

View File

@ -82,7 +82,10 @@ export default class SendCreate extends Component {
let feeSatoshi = new BigNumber(this.state.fee);
feeSatoshi = feeSatoshi.mul(100000000);
satoshiPerByte = feeSatoshi.div(Math.round(tx.length / 2));
satoshiPerByte = Math.round(satoshiPerByte.toString(10));
satoshiPerByte = Math.floor(satoshiPerByte.toString(10));
if (satoshiPerByte < 1) {
throw new Error('Not enough fee. Increase the fee');
}
} catch (err) {
console.log(err);
return this.setState({

View File

@ -117,7 +117,7 @@ export default class SendDetails extends Component {
} catch (err) {
return balance;
}
console.log(typeof availableBalance, availableBalance);
return (availableBalance === 'NaN' && balance) || availableBalance;
}
@ -146,6 +146,14 @@ export default class SendDetails extends Component {
return;
}
if (this.recalculateAvailableBalance(this.state.fromWallet.getBalance(), this.state.amount, this.state.fee) < 0) {
this.setState({
errorMessage: loc.send.details.amount_fiels_is_not_valid,
});
console.log('validation error');
return;
}
this.setState({
errorMessage: '',
});