MCPcopy Create free account
hub / github.com/DNAProject/DNA / TransArryByteToHexString

Function TransArryByteToHexString

http/base/common/common.go:199–226  ·  view source on GitHub ↗
(ptx *types.Transaction)

Source from the content-addressed store, hash-verified

197}
198
199func TransArryByteToHexString(ptx *types.Transaction) *Transactions {
200 trans := new(Transactions)
201 trans.TxType = ptx.TxType
202 trans.Nonce = ptx.Nonce
203 trans.GasLimit = ptx.GasLimit
204 trans.GasPrice = ptx.GasPrice
205 trans.Payer = ptx.Payer.ToBase58()
206 trans.Payload = TransPayloadToHex(ptx.Payload)
207
208 trans.Attributes = make([]TxAttributeInfo, 0)
209 trans.Sigs = []Sig{}
210 for _, sigdata := range ptx.Sigs {
211 sig, _ := sigdata.GetSig()
212 e := Sig{M: sig.M}
213 for i := 0; i < len(sig.PubKeys); i++ {
214 key := keypair.SerializePublicKey(sig.PubKeys[i])
215 e.PubKeys = append(e.PubKeys, common.ToHexString(key))
216 }
217 for i := 0; i < len(sig.SigData); i++ {
218 e.SigData = append(e.SigData, common.ToHexString(sig.SigData[i]))
219 }
220 trans.Sigs = append(trans.Sigs, e)
221 }
222
223 mhash := ptx.Hash()
224 trans.Hash = mhash.ToHexString()
225 return trans
226}
227
228func SendTxToPool(txn *types.Transaction) (ontErrors.ErrCode, string) {
229 if errCode, desc := bactor.AppendTxToPool(txn); errCode != ontErrors.ErrNoError {

Callers 1

GetBlockInfoFunction · 0.85

Calls 6

ToHexStringFunction · 0.92
TransPayloadToHexFunction · 0.85
ToBase58Method · 0.80
GetSigMethod · 0.80
HashMethod · 0.65
ToHexStringMethod · 0.45

Tested by

no test coverage detected