@@ -29,10 +29,10 @@ type (
29
29
)
30
30
31
31
// Hash computes the TMHASH hash of the wire encoded transaction. It attempts to
32
- // unwrap the transaction if it is a MalleatedTx or a BlobTx.
32
+ // unwrap the transaction if it is a IndexWrapper or a BlobTx.
33
33
func (tx Tx ) Hash () []byte {
34
- if malleatedTx , isMalleated := UnmarshalMalleatedTx (tx ); isMalleated {
35
- return tmhash .Sum (malleatedTx .Tx )
34
+ if indexWrapper , isIndexWrapper := UnmarshalIndexWrapper (tx ); isIndexWrapper {
35
+ return tmhash .Sum (indexWrapper .Tx )
36
36
}
37
37
if blobTx , isBlobTx := UnmarshalBlobTx (tx ); isBlobTx {
38
38
return tmhash .Sum (blobTx .Tx )
@@ -41,13 +41,13 @@ func (tx Tx) Hash() []byte {
41
41
}
42
42
43
43
// Key returns the sha256 hash of the wire encoded transaction. It attempts to
44
- // unwrap the transaction if it is a BlobTx or a MalleatedTx .
44
+ // unwrap the transaction if it is a BlobTx or a IndexWrapper .
45
45
func (tx Tx ) Key () TxKey {
46
46
if blobTx , isBlobTx := UnmarshalBlobTx (tx ); isBlobTx {
47
47
return sha256 .Sum256 (blobTx .Tx )
48
48
}
49
- if malleatedTx , isMalleated := UnmarshalMalleatedTx (tx ); isMalleated {
50
- return sha256 .Sum256 (malleatedTx .Tx )
49
+ if indexWrapper , isIndexWrapper := UnmarshalIndexWrapper (tx ); isIndexWrapper {
50
+ return sha256 .Sum256 (indexWrapper .Tx )
51
51
}
52
52
return sha256 .Sum256 (tx )
53
53
}
@@ -208,36 +208,36 @@ func ComputeProtoSizeForTxs(txs []Tx) int64 {
208
208
return int64 (pdData .Size ())
209
209
}
210
210
211
- // UnmarshalMalleatedTx attempts to unmarshal the provided transaction into a
212
- // malleated transaction. It returns true if the provided transaction is a
213
- // malleated transaction. A malleated transaction is a transaction that contains
211
+ // UnmarshalIndexWrapper attempts to unmarshal the provided transaction into an
212
+ // IndexWrapper transaction. It returns true if the provided transaction is an
213
+ // IndexWrapper transaction. An IndexWrapper transaction is a transaction that contains
214
214
// a MsgPayForBlob that has been wrapped with a share index.
215
215
//
216
216
// NOTE: protobuf sometimes does not throw an error if the transaction passed is
217
- // not a tmproto.MalleatedTx , since the protobuf definition for MsgPayForBlob is
217
+ // not a tmproto.IndexWrapper , since the protobuf definition for MsgPayForBlob is
218
218
// kept in the app, we cannot perform further checks without creating an import
219
219
// cycle.
220
- func UnmarshalMalleatedTx (tx Tx ) (malleatedTx tmproto.MalleatedTx , isMalleated bool ) {
221
- // attempt to unmarshal into a a malleated transaction
222
- err := proto .Unmarshal (tx , & malleatedTx )
220
+ func UnmarshalIndexWrapper (tx Tx ) (indexWrapper tmproto.IndexWrapper , isIndexWrapper bool ) {
221
+ // attempt to unmarshal into an IndexWrapper transaction
222
+ err := proto .Unmarshal (tx , & indexWrapper )
223
223
if err != nil {
224
- return malleatedTx , false
224
+ return indexWrapper , false
225
225
}
226
- if malleatedTx .TypeId != consts .ProtoMalleatedTxTypeID {
227
- return malleatedTx , false
226
+ if indexWrapper .TypeId != consts .ProtoIndexWrapperTypeID {
227
+ return indexWrapper , false
228
228
}
229
- return malleatedTx , true
229
+ return indexWrapper , true
230
230
}
231
231
232
- // MarshalMalleatedTx creates a wrapped Tx that includes the original transaction
232
+ // MarshalIndexWrapper creates a wrapped Tx that includes the original transaction
233
233
// and the share index of the start of its blob.
234
234
//
235
235
// NOTE: must be unwrapped to be a viable sdk.Tx
236
- func MarshalMalleatedTx (shareIndex uint32 , tx Tx ) (Tx , error ) {
237
- wTx := tmproto.MalleatedTx {
236
+ func MarshalIndexWrapper (shareIndex uint32 , tx Tx ) (Tx , error ) {
237
+ wTx := tmproto.IndexWrapper {
238
238
Tx : tx ,
239
239
ShareIndex : shareIndex ,
240
- TypeId : consts .ProtoMalleatedTxTypeID ,
240
+ TypeId : consts .ProtoIndexWrapperTypeID ,
241
241
}
242
242
return proto .Marshal (& wTx )
243
243
}
0 commit comments