Ms O'Connor said both men had known each other for a few years and were acquaintances.
She said Paewhenua grew up in Otangarei but lived in Auckland, while Mr Mahanga moved to Whangarei from Moerewa in July last year and got on well with women.
On the day of the shooting, Ms O'Connor said, Paewhenua arranged to meet his former domestic partner in a Whangarei motel and texted Mr Mahanga asking where he was.
At the hotel during the former couple's meeting, Paewhenua became agitated and suspected the woman had cheated on him.
"He said to her, 'I think you've been sleeping with heaps of people. I have to go and shoot them'."
Ms O'Connor said Mr Mahanga arrived back in Whangarei from Auckland just after 8pm that night and both men caught up.
During a phone conversation that night, Mr Mahanga told a woman Paewhenua was in the car with him and would stay with him.
At 10.07pm, Mr O'Connor said the woman answered her phone and it appeared to have been a pocket call from Mr Mahanga's phone that lasted 35 seconds.
She heard someone on the phone said: "What did you say about my missus bro?"
Ms O'Connor said a resident who heard a gun shot looked out of his home and saw a man wearing grey trackpants and a black hoodie going past his house carrying a firearm.
She said another crown witness, a female, would tell the court Mr Mahanga told her he gave his motorbike to Paewhenua but did not receive any payment for it.
Paewhenua was arrested in Auckland on November 16 last year and declined to make a statement to police.
His lawyer, Arthur Fairley, told the jury the Crown's case was circumstantial because no one saw who killed Mr Mahanga. He said the Crown could not make the jury sure Paewhenua was the killer. The trial before Justice Rebecca Edwards continues.