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

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

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

            ToBytesSink(obj, to);
            return(to.Bytes());
        }
Esempio n. 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;
        }
Esempio n. 7
0
 public void AddLengthEncoded(BytesList bytes)
 {
     Add(EncodeVl(bytes.BytesLength));
     Add(bytes);
 }
Esempio n. 8
0
 public BinaryWriter(BytesList list)
 {
     _list = list;
 }
Esempio n. 9
0
 public void AddLengthEncoded(BytesList bytes)
 {
     Add(EncodeVl(bytes.BytesLength));
     Add(bytes);
 }
Esempio n. 10
0
 public void AddLengthEncoded(ISerializedType value)
 {
     var bytes = new BytesList();
     value.ToBytesSink(bytes);
     AddLengthEncoded(bytes);
 }