Java 类org.bitcoinj.core.ProtocolException 实例源码

项目:bitnym    文件:Mixer.java   
private Transaction deserializeTransaction(byte[] arg0) {
    Transaction rcvdTx = null;
    BitcoinSerializer bs = new BitcoinSerializer(params, false);
    try {
        rcvdTx = bs.makeTransaction(arg0);          
    } catch (ProtocolException e) {
        e.printStackTrace();
    }
    return rcvdTx;
}
项目:consensusj    文件:BlockHexDeserializer.java   
@Override
public Block deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    JsonToken token = p.getCurrentToken();
    switch (token) {
        case VALUE_STRING:
            try {
                byte[] payload = HexUtil.hexStringToByteArray(p.getValueAsString()); // convert  to hex
                return context.getParams().getDefaultSerializer().makeBlock(payload);
            } catch (ProtocolException e) {
                throw new InvalidFormatException(p, "Invalid Block", p.getValueAsString(), Block.class);
            }
        default:
            return (Block) ctxt.handleUnexpectedToken(Block.class, p);
    }
}