@@ -35,16 +35,16 @@ namespace ripple {
35
35
class STTxWr
36
36
{
37
37
private:
38
- STTx tx_; // Wrap an instance of STTx
38
+ std::shared_ptr< STTx> tx_; // Wrap an instance of STTx
39
39
bool isDelegated_; // if the transaction is delegated by another account
40
40
41
41
public:
42
- explicit STTxWr (STTx tx, bool isDelegated)
43
- : tx_(tx ), isDelegated_(isDelegated)
42
+ explicit STTxWr (STTx const & tx, bool isDelegated)
43
+ : tx_(std::make_shared<STTx>(tx) ), isDelegated_(isDelegated)
44
44
{
45
45
}
46
46
47
- STTx
47
+ std::shared_ptr< STTx>
48
48
getTx () const
49
49
{
50
50
return tx_;
@@ -60,9 +60,9 @@ class STTxWr
60
60
getAccountID (SField const & field) const
61
61
{
62
62
if (field == sfAccount)
63
- return tx_. isFieldPresent (sfOnBehalfOf) ? *tx_[~sfOnBehalfOf]
64
- : tx_[sfAccount];
65
- return tx_. getAccountID (field);
63
+ return tx_-> isFieldPresent (sfOnBehalfOf) ? *(* tx_) [~sfOnBehalfOf]
64
+ : (* tx_) [sfAccount];
65
+ return tx_-> getAccountID (field);
66
66
}
67
67
68
68
template <class T >
@@ -71,7 +71,7 @@ class STTxWr
71
71
typename T::value_type>::type
72
72
operator [](TypedField<T> const & f) const
73
73
{
74
- return tx_[f];
74
+ return (* tx_) [f];
75
75
}
76
76
77
77
// When Type is SF_ACCOUNT and also field name is sfAccount, we need to
@@ -84,124 +84,124 @@ class STTxWr
84
84
operator [](TypedField<T> const & f) const
85
85
{
86
86
if (f == sfAccount)
87
- return tx_. isFieldPresent (sfOnBehalfOf) ? *tx_[~sfOnBehalfOf]
88
- : tx_[sfAccount];
89
- return tx_[f];
87
+ return tx_-> isFieldPresent (sfOnBehalfOf) ? *(* tx_) [~sfOnBehalfOf]
88
+ : (* tx_) [sfAccount];
89
+ return (* tx_) [f];
90
90
}
91
91
92
92
template <class T >
93
93
std::optional<std::decay_t <typename T::value_type>>
94
94
operator [](OptionaledField<T> const & of) const
95
95
{
96
- return tx_[of];
96
+ return (* tx_) [of];
97
97
}
98
98
99
99
uint256
100
100
getTransactionID () const
101
101
{
102
- return tx_. getTransactionID ();
102
+ return tx_-> getTransactionID ();
103
103
}
104
104
105
105
TxType
106
106
getTxnType () const
107
107
{
108
- return tx_. getTxnType ();
108
+ return tx_-> getTxnType ();
109
109
}
110
110
111
111
std::uint32_t
112
112
getFlags () const
113
113
{
114
- return tx_. getFlags ();
114
+ return tx_-> getFlags ();
115
115
}
116
116
117
117
bool
118
118
isFieldPresent (SField const & field) const
119
119
{
120
- return tx_. isFieldPresent (field);
120
+ return tx_-> isFieldPresent (field);
121
121
}
122
122
123
123
Json::Value
124
124
getJson (JsonOptions options) const
125
125
{
126
- return tx_. getJson (options);
126
+ return tx_-> getJson (options);
127
127
}
128
128
129
129
void
130
130
add (Serializer& s) const
131
131
{
132
- tx_. add (s);
132
+ tx_-> add (s);
133
133
}
134
134
135
135
unsigned char
136
136
getFieldU8 (SField const & field) const
137
137
{
138
- return tx_. getFieldU8 (field);
138
+ return tx_-> getFieldU8 (field);
139
139
}
140
140
141
141
std::uint32_t
142
142
getFieldU32 (SField const & field) const
143
143
{
144
- return tx_. getFieldU32 (field);
144
+ return tx_-> getFieldU32 (field);
145
145
}
146
146
147
147
uint256
148
148
getFieldH256 (SField const & field) const
149
149
{
150
- return tx_. getFieldH256 (field);
150
+ return tx_-> getFieldH256 (field);
151
151
}
152
152
153
153
Blob
154
154
getFieldVL (SField const & field) const
155
155
{
156
- return tx_. getFieldVL (field);
156
+ return tx_-> getFieldVL (field);
157
157
}
158
158
159
159
STAmount const &
160
160
getFieldAmount (SField const & field) const
161
161
{
162
- return tx_. getFieldAmount (field);
162
+ return tx_-> getFieldAmount (field);
163
163
}
164
164
165
165
STPathSet const &
166
166
getFieldPathSet (SField const & field) const
167
167
{
168
- return tx_. getFieldPathSet (field);
168
+ return tx_-> getFieldPathSet (field);
169
169
}
170
170
171
171
const STVector256&
172
172
getFieldV256 (SField const & field) const
173
173
{
174
- return tx_. getFieldV256 (field);
174
+ return tx_-> getFieldV256 (field);
175
175
}
176
176
177
177
const STArray&
178
178
getFieldArray (SField const & field) const
179
179
{
180
- return tx_. getFieldArray (field);
180
+ return tx_-> getFieldArray (field);
181
181
}
182
182
183
183
Blob
184
184
getSigningPubKey () const
185
185
{
186
- return tx_. getSigningPubKey ();
186
+ return tx_-> getSigningPubKey ();
187
187
}
188
188
189
189
Blob
190
190
getSignature () const
191
191
{
192
- return tx_. getSignature ();
192
+ return tx_-> getSignature ();
193
193
}
194
194
195
195
bool
196
196
isFlag (std::uint32_t f) const
197
197
{
198
- return tx_. isFlag (f);
198
+ return tx_-> isFlag (f);
199
199
}
200
200
201
201
SeqProxy
202
202
getSeqProxy () const
203
203
{
204
- return tx_. getSeqProxy ();
204
+ return tx_-> getSeqProxy ();
205
205
}
206
206
};
207
207
0 commit comments