use of co.rsk.bitcoinj.core.AddressFormatException in project rskj by rsksmart.
the class BridgeSupport method addOneOffLockWhitelistAddress.
/**
* Adds the given address to the lock whitelist.
* Returns 1 upon success, or -1 if the address was
* already in the whitelist.
* @param addressBase58 the base58-encoded address to add to the whitelist
* @param maxTransferValue the max amount of satoshis enabled to transfer for this address
* @return 1 upon success, -1 if the address was already
* in the whitelist, -2 if address is invalid
* LOCK_WHITELIST_GENERIC_ERROR_CODE otherwise.
*/
public Integer addOneOffLockWhitelistAddress(Transaction tx, String addressBase58, BigInteger maxTransferValue) {
try {
Address address = getParsedAddress(addressBase58);
Coin maxTransferValueCoin = Coin.valueOf(maxTransferValue.longValueExact());
return this.addLockWhitelistAddress(tx, new OneOffWhiteListEntry(address, maxTransferValueCoin));
} catch (AddressFormatException e) {
logger.warn(INVALID_ADDRESS_FORMAT_MESSAGE, e);
return LOCK_WHITELIST_INVALID_ADDRESS_FORMAT_ERROR_CODE;
}
}
Aggregations