예제 #1
0
 public void Add(BytesList bl)
 {
     foreach (var bytes in bl.RawList)
     {
         Add(bytes);
     }
 }
예제 #2
0
        public string ToHex(TIn obj)
        {
            var to = new BytesList();

            ToBytesSink(obj, to);
            return(to.BytesHex());
        }
예제 #3
0
 public void Add(BytesList bl)
 {
     foreach (var bytes in bl.RawList)
     {
         Add(bytes);
     }
 }
예제 #4
0
        public void AddLengthEncoded(ISerializedType value)
        {
            var bytes = new BytesList();

            value.ToBytesSink(bytes);
            AddLengthEncoded(bytes);
        }
예제 #5
0
        public byte[] ToBytes(TIn obj)
        {
            var to = new BytesList();

            ToBytesSink(obj, to);
            return(to.Bytes());
        }
예제 #6
0
        public void Prepare(IKeyPair keyPair, Amount fee, UInt32 sequence, UInt32 lastLedgerSequence)
        {
            // This won't always be specified
            if (lastLedgerSequence != null)
            {
                Txn.Add(UInt32.LastLedgerSequence, lastLedgerSequence);
            }

            Txn.Add(UInt32.Sequence, sequence);
            Txn.Add(Amount.Fee, fee);
            Txn.Add(VariableLength.SigningPubKey, keyPair.PubBytes());

            if (Transaction.CanonicalFlagDeployed)
            {
                Txn.SetCanonicalSignatureFlag();
            }

            SigningHash = Txn.SigningHash();
            if (PreviousSigningHash != null && SigningHash.Equals(PreviousSigningHash))
            {
                return;
            }

            try
            {
                byte[] signature = keyPair.Sign(SigningHash.Bytes);
                Txn.Add(VariableLength.TxnSignature, signature);

                var blob = new BytesList();
                Hash256.HalfSha512 id = Hash256.Prefixed256(HashPrefix.TransactionId);

                Txn.ToBytesSink(new MultiSink(blob, id));
                TxBlob = blob.BytesHex();
                Hash = id.Finish();
            }
            catch (Exception e)
            {
                // electric paranoia
                PreviousSigningHash = null;
                throw new ApplicationException("Something went wrong.", e);
            }

            PreviousSigningHash = SigningHash;
        }
예제 #7
0
 public void AddLengthEncoded(BytesList bytes)
 {
     Add(EncodeVl(bytes.BytesLength));
     Add(bytes);
 }
예제 #8
0
 public BinaryWriter(BytesList list)
 {
     _list = list;
 }
예제 #9
0
 public void AddLengthEncoded(BytesList bytes)
 {
     Add(EncodeVl(bytes.BytesLength));
     Add(bytes);
 }
예제 #10
0
 public void AddLengthEncoded(ISerializedType value)
 {
     var bytes = new BytesList();
     value.ToBytesSink(bytes);
     AddLengthEncoded(bytes);
 }