Skip to content

Commit

Permalink
delete input if not used
Browse files Browse the repository at this point in the history
Signed-off-by: georgi-l95 <[email protected]>
  • Loading branch information
georgi-l95 committed Apr 19, 2024
1 parent eba7898 commit 3925c53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/relay/src/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ const formatTransaction = (transaction: any) => {
*/
if (transaction.input && transaction.input.length > 0 && !transaction.data) {
transaction.data = transaction.input;
// As input is not used anywere in the mirror-node, we are setting it to empty string to not clutter the request with redundant data
transaction.input = '';
delete transaction.input;
}
};

Expand Down
4 changes: 2 additions & 2 deletions packages/relay/tests/lib/formatters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Formatters', () => {
formatTransaction(transaction);

expect(transaction.data).to.be('input data');
expect(transaction.input).to.be('');
expect(transaction.input).to.be.undefined;
});

it('should not modify transaction if input is empty and data is present', () => {
Expand All @@ -112,7 +112,7 @@ describe('Formatters', () => {
formatTransaction(transaction);

expect(transaction.data).to.eq('some data');
expect(transaction.input).to.equal('');
expect(transaction.input).to.be('');
expect(transaction.to).to.eq('receiver');
});

Expand Down

0 comments on commit 3925c53

Please sign in to comment.